Fix flaky DConcurrencyTestFixture.GlobalLockWaitIsInterruptibleBlockedOnRSTL under featureFlagIntentRegistration

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • CAR Team 2026-07-20
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      DConcurrencyTestFixture.GlobalLockWaitIsInterruptibleBlockedOnRSTL in src/mongo/db/shard_role/lock_manager/d_concurrency_test.cpp is intermittently failing on the TSAN unit test variant (enterprise-rhel8-debug-tsan-compile):

      d_concurrency_test.cpp:759: Failure
      Expected: result.get() throws an exception of type mongo::AssertionException which is an object whose property `code` is equal to Interrupted
        Actual: does not throw
      

      Mainline history shows this has been intermittently failing since 2026-06-01 at roughly a 10-13% rate on high-volume run days (e.g. 5/53 on 06-01, 8/81 on 06-12, 16/91 on 07-06), rather than being a clean pass/fail regression.

      Root Cause

      The test holds a raw RSTL (resourceIdReplicationStateTransitionLock) in MODE_X on opCtx1 and expects a conflicting Lock::GlobalLock(opCtx2, MODE_S) to block, so that killing opCtx2 interrupts the wait and throws ErrorCodes::Interrupted.

      Since featureFlagIntentRegistration was enabled by default in SERVER-101475 (commit a3fd686d3e4, 2026-05-28), Lock::GlobalLock no longer acquires the RSTL at all:

      if (gFeatureFlagIntentRegistration.isEnabled() || options.skipRSTLLock) {
          _declareIntent(lockMode, options.explicitIntent);
          _takeGlobalLockOnly(lockMode, deadline);   // RSTL is never touched
      } else {
          _takeGlobalAndRSTLLocks(lockMode, deadline, options.explicitIntent);
      }
      

      With the flag enabled, opCtx2's GlobalLock(MODE_S) therefore does not conflict with the raw RSTL held by opCtx1, so the acquisition never blocks. The test then degenerates into an unsynchronized race between opCtx2's (now non-blocking) lock acquisition and runTaskAndKill's markKilled() call. Under TSAN's perturbed thread scheduling, the acquisition occasionally completes before the kill is observed, so no exception is thrown.

            Assignee:
            Igor Praznik
            Reporter:
            Igor Praznik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: