[SERVER-60621] Investigate if we can ban upgrading the global lock Created: 12/Oct/21  Updated: 29/Oct/23  Resolved: 03/Feb/23

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

Type: Task Priority: Major - P3
Reporter: Dan Larkin-York Assignee: Fausto Leyva (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-61601 Determine if global lock upgrade is n... Closed
depends on SERVER-61609 Determine if global lock upgrade is n... Closed
depends on SERVER-61733 Determine if global lock upgrade is n... Closed
depends on SERVER-61786 Determine if we can avoid global lock... Closed
depends on SERVER-61788 Determine if we can avoid global lock... Closed
depends on SERVER-61789 Determine if we can avoid global lock... Closed
depends on SERVER-66609 Avoid global lock upgrade in storage_... Closed
depends on SERVER-67695 Remove the write-blocking mode of dbC... Closed
is depended on by SERVER-73040 Ban all lock upgrades Closed
Related
is related to SERVER-66145 Identify and fix locations that write... Closed
is related to SERVER-66719 dbCheck FCV lock upgrade causes deadl... Closed
Assigned Teams:
Storage Execution
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2023-02-20, Execution Team 2023-02-06
Participants:
Linked BF Score: 169

 Description   

Upgrading the global lock mode without first releasing the lock held can have bad side effects (namely deadlock and resource exhaustion). We've removed some cases where this can happen (most recently in SERVER-59219). We think we can explicitly ban this behavior in code, as it could help us identify additional bugs we haven't hit yet, and avoid future ones. That said, there are some instances where we currently upgrade the global lock, and we'll need to fix these first.



 Comments   
Comment by Fausto Leyva (Inactive) [ 03/Feb/23 ]

Since all global lock upgrades are banned, the objective of this ticket has been met. 

Closing this ticket and moving the rest of the work to ban all lock upgrades to ticket: SERVER-73040

Comment by Louis Williams [ 16/Dec/22 ]

After max.hirschhorn@mongodb.com pointed it out, we discovered that a specific deadlock is possible due to lock conversions:

T1					T2
---------------------------------------
IS			
					S
convert IX -> blocks
					convert X -> blocks

Since SERVER-66145 is now merged, global lock upgrades are effectively banned, but using tickets as a proxy. Since some operations don't acquire tickets, and because there are more locks than just the global lock, we should use this ticket to eliminate upgrades on all locks. Any dangerous upgrades should be evaluated for backport consideration.

Comment by Louis Williams [ 24/May/22 ]

I would like to consider banning all lock upgrades, not just global lock upgrades. We can start just with locks in the global hierarchy.

Comment by Githook User [ 01/Dec/21 ]

Author:

{'name': 'Dan Larkin-York', 'email': 'dan.larkin-york@mongodb.com', 'username': 'dhly-etc'}

Message: SERVER-60621 Avoid global lock upgrade in some C++ tests
Branch: master
https://github.com/mongodb/mongo/commit/d2939d2ce7e46094a5a151f55040a577fed9a3e6

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