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 race condition #69

Closed
wants to merge 1 commit into from

Conversation

sergej-koscejev
Copy link
Contributor

Condition variables are used incorrectly in this code.

If signalInitialized() is called before waiting for it, it will not be registered and the thread unnecessarily waits for 100 seconds.

In addition, if the timeout expires we probably want to report this as an error but the thread instead continues to run.

Using a CountDownLatch instead of Condition and ReentrantLock fixes both problems.

Condition variables are used incorrectly in this code.

If signalInitialized() is called before waiting for it, it will not be
registered and the thread unnecessarily waits for 100 seconds.

In addition, if the timeout expires we probably want to report this as
an error but the thread instead continues to run.

Using a CountDownLatch instead of Condition and ReentrantLock fixes both
problems.
@sergej-koscejev
Copy link
Contributor Author

@ashatalin
Copy link
Member

Was merged into the code base

@ashatalin ashatalin closed this Dec 19, 2023
@sergej-koscejev sergej-koscejev deleted the 2022.2 branch December 19, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants