-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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 in port reintroduction test #11735
fix race condition in port reintroduction test #11735
Conversation
} | ||
|
||
doneTakingPorts.countDown(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does the latch help this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We wait on this assertTrue(doneTakingPorts.await(5, TimeUnit.SECONDS));
What this allows us to do is handle the case where it was taking an additional element in the thread before draining. Now it actually waits for the thread to complete using this mechanism so we guarantee the thread isn't touching the portsTaken
list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Pity. I thought this would help with the socket hanging issue we are seeing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly no.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you manage to run this locally in succession without running into the transient error I did?
I ran this a bunch of times and it works at least way more commonly. |
fixes #9650 (comment)
This locks properly around accessing the ports now. The problem before was that it could be in the middle of a
take
in the background thread when it wasn't supposed to be.