ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      Make mongod shutdown honor the PinnedConnectionTaskExecutor (PCTE) lifetime contract, so a $search cursor created during shutdown cannot outlive its underlying mongot task executor. This closes the invariant failure tracked by AF-21589 (same class as AF-4442 / SERVER-108562).

      Scope

      1. Gate new mongot cursor creation: once search-executor shutdown begins, cursor acquisition fails fast with ShutdownInProgress (convention already documented in search_task_executors.h) so no new PCTE can appear during the drain window.
      2. Full drain: extend SERVER-129849's idle-cursor disposal to dispose/kill all live mongot cursors within the shutdown timer bucket, so executor::shutdownPinnedExecutors observes every live PCTE before the underlying executor shuts down.
      3. Registry hardening (folded in): executor::shutdownPinnedExecutors iterates the PCTE registry without synchronizing. Make that access safe (lock the synchronized_value, hold drained shared_ptrs, skip expired weak_ptrs) so teardown racing shutdown cannot dereference a freed entry.
      4. Deterministic test: new failPoint between the drain and the underlying executor shutdown; a jstest pauses there, establishes a $search from a parallel shell, releases, and asserts mongod does not crash and the query fails cleanly (red on master, green with the gate).

      Prior attempt (do not repeat)

      Delivering the remote-command completion on the operation's networking baton was tried and rejected: patch build 3848 showed pinned TaskExecutorCursor teardown depends on outstanding commands completing without an active opCtx wait, so baton delivery strands the completion and deadlocks teardown. No changes to OutOfLineExecutor / GuaranteedExecutor.

      Related

      AF-21589; SERVER-108562 (Works as Designed - caller owns the contract); SERVER-129849 (predecessor ordering work); SERVER-127122 (PCTE registry token lifetime).

            Assignee:
            Mariano Shaar
            Reporter:
            Mariano Shaar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: