opCtx interruptions are ignored during lock re-acquisition

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • ALL
    • CAR Team 2025-08-04
    • None
    • 3
    • TBD
    • 🟦 Shard Catalog
    • None
    • None
    • None
    • None
    • None
    • None

      Lock acquisitions are not allowed to succeed when opCtx is marked as interrupted.
      In fact the contract of `Locker::lock` is that it will throw an Interruption exception if this occurs.

      There is one specific case in which the the Locker does not honor this contract. In fact if a thread acquire and then release a lock, leaving it in unlockPending state. When it tries to lock it again it will succeeded even if operation context has been interrupted.
      The scenario looks like the following:

      1. T1 acquire lock L1
      2. T1 release lock L1 (leaving it in unlockPending state)
      3. T1's operation context gets marked as interrupted
      4. T1 acquire lock L1 again

      At (4.) the locker shuld throw an exception of category "Interruption" but it is not.

      The check for interruption is done in the Locker::_beginLock function, the problem is that if the lock is in unlockPending state we take an early exit that skips this check.

              Assignee:
              Tommaso Tocci
              Reporter:
              Tommaso Tocci
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: