[SERVER-73266] Deadlock among createIndexes, index build commit, and step down Created: 24/Jan/23  Updated: 29/Oct/23  Resolved: 31/Jan/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0-rc0, 6.0.5

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

Issue Links:
Backports
Depends
Assigned Teams:
Storage Execution
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.0, v5.0
Sprint: Execution Team 2023-02-06
Participants:
Linked BF Score: 136

 Description   

In order to commit, an index build takes an X lock on its on its collection after explicitly unlocking the RSTL. Then a createIndexes command enqueues a collection IS lock (which implicitly takes the RSTL in IX) in order to check the TTL options on the command object. Now a step down occurs, enqueuing the RSTL in mode X. Now the index build attempts to take a collection IX lock on the config.system.indexBuilds collection, which first enqueues the RSTL in IX since it was previously unlocked. Thus a three-way deadlock has been reached. It seems the issue is that we should be waiting to re-acquire the RSTL until the subsequent timeout-retry logic.



 Comments   
Comment by Githook User [ 01/Feb/23 ]

Author:

{'name': 'Gregory Noma', 'email': 'gregory.noma@gmail.com', 'username': 'gregorynoma'}

Message: SERVER-73266 Avoid retaking RSTL without timeout at index build commit

(cherry picked from commit 35370b26c155a89a540137fe168da98175a431bf)
Branch: v6.0
https://github.com/mongodb/mongo/commit/e0fd004387a3ec6668f0a3dfba9c5cdbbf1be71f

Comment by Githook User [ 31/Jan/23 ]

Author:

{'name': 'Gregory Noma', 'email': 'gregory.noma@gmail.com', 'username': 'gregorynoma'}

Message: SERVER-73266 Avoid retaking RSTL without timeout at index build commit
Branch: master
https://github.com/mongodb/mongo/commit/35370b26c155a89a540137fe168da98175a431bf

Generated at Thu Feb 08 06:24:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.