[SERVER-33413] nia countdownlatch misuses condvars Created: 20/Feb/18  Updated: 08/Jan/24  Resolved: 09/Apr/18

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.7.4

Type: Bug Priority: Major - P3
Reporter: Mira Carey Assignee: Mira Carey
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 2018-03-26, Platforms 2018-04-09, Platforms 2018-04-23
Participants:

 Description   

Part of the testing code in network_interface_asio_test_utils.h is a countdown latch. The latch relies on releasing writes alongside a condvar by writing to an atomic and calling notify (rather than sync'ing on the mutex the condvar is waiting on). This isn't the right way to use condvars and can be re-ordered to hang forever.

We should drop the atomic and always take the mutex when writing to a non-atomic



 Comments   
Comment by Githook User [ 09/Apr/18 ]

Author:

{'email': 'jcarey@argv.me', 'name': 'Jason Carey', 'username': 'hanumantmk'}

Message: SERVER-33413 nia countdownlatch misues condvars

You have to hold the mutex that a condvar is waiting on while modifying
the shared state the predicate checks for, or you can see a misordered
write and hang forever.
Branch: master
https://github.com/mongodb/mongo/commit/9be2c132cb4713e13bbaa5648077e5346a29c99b

Generated at Thu Feb 08 04:33:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.