-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Cluster Scalability
-
Fully Compatible
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Coverity
There have been 61 missing_lock coverity errors, most around SharedPromise usage.
In SERVER-119208, Coverity is describing a pattern of fulfilling a SharedFuture while holding an exclusive lock, but retrieving a SharedFuture without holding a lock.
- On write (ensureFulfilledPromise) in _onCoordinatorStateAdvanced, a lock is held on _mutex.
- On read, _allRecipientsDoneCloning.getFuture() is not protected by _mutex.
SharedPromise
Per the SharedPromise class documentation:
Any number of threads can extract a future at the same time. It is also safe to extract a future concurrently with completing the promise.
This was confirmed in a thread in #server-programmability.
Basically, get() and getFuture() are safe, the reads and writes to promise or future themselves may need external synchronization.
Proposal
To standardize our SharedPromise usage, all occurrences that lock on a getFuture call should be changed to remove the lock_guard.
To prevent future Coverity issues, a Coverity suppression should be added for all getFuture usages.
- related to
-
SERVER-128599 Ensure _changeStreamsMonitorStarted is fulfilled under exclusive lock
-
- Closed
-