[SERVER-53996] Recipient should not do reads/writes while holding the instance mutex Created: 22/Jan/21  Updated: 29/Oct/23  Resolved: 09/Feb/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Bug Priority: Major - P3
Reporter: Lingzhi Deng Assignee: Xuerui Fa
Resolution: Fixed Votes: 0
Labels: pm-1791_other_required
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-60872 Deadlock between stepDown and TenantO... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Repl 2021-02-08, Repl 2021-02-22
Participants:
Linked BF Score: 10

 Description   

Recipient updates state docs while holding onto the instance mutex, see this example. This is problematic because updateStateDoc needs to acquire RSTL in IX mode but stepDown would interrupt() the migration (as part of _performPostMemberStateUpdateAction) while holding RSTL in X mode. interrupt() needs to acquire the instance mutex. So this could introduce a deadlock - the updateStateDoc on the recipient thread waits on RSTL IX mode v.s. the interrupt() on stepDown thread is waiting on the instance mutex while holding RSTL in X mode.



 Comments   
Comment by Githook User [ 09/Feb/21 ]

Author:

{'name': 'XueruiFa', 'email': 'xuerui.fa@mongodb.com', 'username': 'XueruiFa'}

Message: SERVER-53996: Avoid holding mutex while reading/writing in tenant migration recipient
Branch: master
https://github.com/mongodb/mongo/commit/2a1c62250ab5c9f089a2e4699d454ed326057b82

Generated at Thu Feb 08 05:32:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.