Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix daemon connection race condition #1078

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

gnodet
Copy link
Contributor

@gnodet gnodet commented Jul 19, 2024

Forward port of #1071

The Server was using a SynchrnousQueue to coordinate the main thread
and the background thread that receives the request from the client.
A SynchronousQueue only allows insertions when a corresponding call
to get is in progress. However, since the receiver thread is started
before the call to get, there was a short time window, where the call
to queue.offer could fail and simply return false. This return code
was ignored.

A possible solution would have been to call put instead of offer,
but I decided to replace the queue with a Future, since we only wait
for a single element.

The Server was using a SynchrnousQueue to coordinate the main thread
and the background thread that receives the request from the client.
A SynchronousQueue only allows insertions when a corresponding call
to `get` is in progress. However, since the receiver thread is started
before the call to `get`, there was a short time window, where the call
to `queue.offer` could fail and simply return `false`. This return code
was ignored.

A possible solution would have been to call `put` instead of `offer`,
but I decided to replace the queue with a Future, since we only wait
for a single element.
@gnodet gnodet added this to the 2.0.0-beta-2 milestone Jul 19, 2024
@gnodet gnodet added the bug Something isn't working label Jul 19, 2024
@gnodet gnodet merged commit 6189475 into apache:master Jul 19, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants