[ 
https://issues.apache.org/jira/browse/CASSANDRA-9962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14654456#comment-14654456
 ] 

Ariel Weisberg edited comment on CASSANDRA-9962 at 8/4/15 11:17 PM:
--------------------------------------------------------------------

Patch looks good but style wise seems like it could be cleaner? A semaphore 
would be an easier way to wait for the thread(s) to be initialized?

For joining on a thread. I usually set the timeout insanely large to account 
for a really big hiccup. Maybe we should define a few constants in Util.java 
for how long to wait for this kind of condition?

There is also no atomicity between signaling ready and getting into the wait 
queue. Is there potential for a lost wakeup there? Seems like the condition you 
really want to spin on is the number of waiters in the wait queue.


was (Author: aweisberg):
Patch looks good but style wise seems like it could be cleaner? A semaphore 
would an easier way to wait for the thread(s) to be initialized?

For joining on a thread. I usually set the timeout insanely large to account 
for a really big hiccup. Maybe we should define a few constants in Util.java 
for how long to wait for this kind of condition?

There is also no atomicity between signaling ready and getting into the wait 
queue. Is there potential for a lost wakeup there? Seems like the condition you 
really want to spin on is the number of waiters in the wait queue.

> WaitQueueTest is flakey
> -----------------------
>
>                 Key: CASSANDRA-9962
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9962
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Benedict
>            Assignee: Benedict
>            Priority: Minor
>             Fix For: 3.x
>
>
> While the test is a little noddy, and superfluous, it shouldn't fail even 
> vanishingly infrequently. [~aweisberg] has spotted it doing so, and I have 
> also encountered it once, so I suspect that a change in hardware/OS may have 
> made vanishingly unlikely just pretty unlikely, which is even less good. 
> Right now it depends on {{Thread.start()}} completing before the new thread 
> starts; this isn't guaranteed. This patch fixes that.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to