[SERVER-67382] Race condition in the UUID <-> NSS resolution in the multi-collection locking path Created: 20/Jun/22  Updated: 29/Oct/23  Resolved: 11/Jul/22

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

Type: Bug Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Dianna Hohensee (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-67383 Layering violation in the lock manager Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2022-07-11, Execution Team 2022-07-25
Participants:

 Description   

Since our lock manager works based on namespaces and not UUIDs, there is an "optimistic" protocol which ensures that a UUID is locked exactly as the namespace that it maps to. The protocol is:

do {
  NSSBeforeLock = optimistically resolve NSS to UUID;
  Lock the NSS();
  NSSAfterLock = optimistically resolve NSS to UUID;
while (NSSBeforeLock == NSSAfterLock);

The above protocol guarantees that when one holds an AutoGetCollection object, the NSS <-> UUID mapping reflects the truth and is stable for the duration of the RAII object.

The multi-collection locking path performs the UUID -> NSS resolution before it invokes the CollectionLock constructor (which is what implements the protocol above) and as a result it is possible that the guarantee above is not met. This is easily reproducible if the "fast" path here is skipped.



 Comments   
Comment by Githook User [ 11/Jul/22 ]

Author:

{'name': 'Dianna Hohensee', 'email': 'dianna.hohensee@mongodb.com', 'username': 'DiannaHohensee'}

Message: SERVER-67382 Refresh the catalog before re-checking UUID <-> NSS resolution in the multi-collection locking path
Branch: master
https://github.com/mongodb/mongo/commit/e222ff7a8f10197d3e4977405216cfd2b852475d

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