[SERVER-35372] replSetSyncFrom can cause deadlock between ReplicationCoordinator and InitialSyncer Created: 04/Jun/18 Updated: 27/Oct/23 Resolved: 18/Jun/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Coverity Collector User | Assignee: | William Schultz (Inactive) |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | coverity | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Sprint: | Repl 2018-07-02 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
The InitialSync::_fcvFetcherCallback function acquires the InitialSync mutex and then acquires the ReplicationCoordinator mutex. This ordering is inconsistent with some functions in ReplicationCoordinator e.g. ReplicationCoordinatorImpl::processReplSetSyncFrom and ReplicationCoordinatorImpl::processReplSetGetStatus. At the time of writing this, the ReplicationCoordinator mutex acquisition was elimiinated in processReplSetGetStatus by ------------------------- Original Coverity Description: Threads may try to acquire two locks in different orders, potentially causing deadlock Defect 103597 (STATIC_C) |
| Comments |
| Comment by William Schultz (Inactive) [ 18/Jun/18 ] |
|
Will be fixed by |
| Comment by William Schultz (Inactive) [ 18/Jun/18 ] |
|
Should also be fixed by |
| Comment by William Schultz (Inactive) [ 18/Jun/18 ] |
|
Not going to mark this as a true duplicate of |
| Comment by William Schultz (Inactive) [ 18/Jun/18 ] |
|
Claims that InitialSyncer::_fcvFetcherCallback calls DataReplicatorExternalStateImpl::getCurrentConfig() while holding InitialSyncer::_mutex. DataReplicatorExternalStateImpl::getCurrentConfig() will end up calling ReplicationCoordinatorImpl::getConfig() which will take the ReplicationCoordinator mutex. So the initial syncer will acquire ReplicationCoodrinator::_mutex while holding InitialSyncer::_mutex. |