Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-67382

Race condition in the UUID <-> NSS resolution in the multi-collection locking path

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • Execution Team 2022-07-11, Execution Team 2022-07-25

      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.

            Assignee:
            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: