[SERVER-34758] replSetGetStatus can deadlock with initialSyncer Created: 30/Apr/18  Updated: 29/Oct/23  Resolved: 13/Jun/18

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.4.16, 3.6.6, 4.0.1, 4.1.1

Type: Bug Priority: Major - P3
Reporter: Matthew Russotto Assignee: Suganthi Mani
Resolution: Fixed Votes: 0
Labels: initialSync
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
related to SERVER-28840 replSetSyncFrom causes InitialSyncer ... Closed
is related to SERVER-35372 replSetSyncFrom can cause deadlock be... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.0, v3.6, v3.4
Sprint: Repl 2018-06-18
Participants:
Linked BF Score: 0

 Description   

When called with initialSync:1, replSetGetStatus locks the ReplicationCoordinatorImpl mutex, then the InitialSyncer mutex.  The InitialSyncer in the course of normal operation will acquire the same locks in the opposite order.  Result: deadlock.

I do not think it is necessary to hold the ReplicationCoordinatorImpl mutex while getting the initialSync status, so the fix may be as simple as getting the initialSync status before acquiring the mutex.

 



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

Author:

{'username': 'smani87', 'name': 'Suganthi Mani', 'email': 'suganthi.mani@mongodb.com'}

Message: SERVER-34758 Fix to prevent deadlock between initial sync and replSetGetStatus cmd when called along with initialSync:1.

(cherry picked from commit 3c6d6969752ad4322594dab171ca7dd26b854bc8)
Branch: v4.0
https://github.com/mongodb/mongo/commit/f70d92c7b617b3b9fe0ecfc808225cb2bcc8bc2d

Comment by Githook User [ 15/Jun/18 ]

Author:

{'username': 'smani87', 'name': 'smani87', 'email': 'suganthi.mani@mongodb.com'}

Message: SERVER-34758 Fix to prevent deadlock between initial sync and replSetGetStatus cmd when called along with initialSync:1.

(cherry picked from commit 3c6d6969752ad4322594dab171ca7dd26b854bc8)
Branch: v3.4
https://github.com/mongodb/mongo/commit/26706cb04de995a2d7252da936ba815217239a60

Comment by Githook User [ 15/Jun/18 ]

Author:

{'username': 'smani87', 'name': 'smani87', 'email': 'suganthi.mani@mongodb.com'}

Message: SERVER-34758 Fix to prevent deadlock between initial sync and replSetGetStatus cmd when called along with initialSync:1.

(cherry picked from commit 3c6d6969752ad4322594dab171ca7dd26b854bc8)
Branch: v3.6
https://github.com/mongodb/mongo/commit/bfa481921abc7ca793d1cdbdd2154c2387f68d13

Comment by Githook User [ 13/Jun/18 ]

Author:

{'username': 'smani87', 'name': 'smani87', 'email': 'suganthi.mani@mongodb.com'}

Message: SERVER-34758 Fix to prevent deadlock between initial sync and replSetGetStatus cmd when called along with initialSync:1.
Branch: master
https://github.com/mongodb/mongo/commit/3c6d6969752ad4322594dab171ca7dd26b854bc8

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