[CDRIVER-1439] Deal with spurious wakeups from pthread_cond_wait Created: 01/Aug/16  Updated: 19/Oct/16  Resolved: 05/Aug/16

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.5.0

Type: Bug Priority: Major - P3
Reporter: Ian Boros Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-1305 Some tests hang on 32-bit Unix Closed

 Description   

From the manpage of pthread_cond_wait():

{block}
When using condition variables there is always a Boolean predicate involving shared variables associated with each condition wait that is true if the thread should proceed. Spurious wakeups from the pthread_cond_timedwait() or pthread_cond_wait() functions may occur. Since the return from pthread_cond_timedwait() or pthread_cond_wait() does not imply anything about the value of this predicate, the predicate should be re-evaluated upon such return.{block}

Basically, pthread_cond_wait can return whenever it feels like! Our code in the mock server (and maybe elsewhere) doesn't deal with this case, and it should.



 Comments   
Comment by Githook User [ 05/Aug/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1439 handle spurious wakeup in mock server

Not a verified bug, but for correctness, re-check the condition after
cond_wait when starting a mock server's background thread.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/0fe818d046886f4facd2c2ef82a879230e76cf42

Comment by A. Jesse Jiryu Davis [ 01/Aug/16 ]

Possible cause of CDRIVER-1305?

Generated at Wed Feb 07 21:12:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.