-
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
- 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.
- 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.
- 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.
- 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).
- is related to
-
SERVER-108562 PinnedConnectionTaskExecutor doesn't handle a shutdown _cancellationExecutor
-
- Closed
-
-
SERVER-129849 Fix mongod shutdown hang waiting for search task executor
-
- In Code Review
-
-
SERVER-127122 Keep PCTE registry token alive until destruction completes
-
- Closed
-
- related to
-
SERVER-108562 PinnedConnectionTaskExecutor doesn't handle a shutdown _cancellationExecutor
-
- Closed
-