|
An operation-fatal error that kills the opCtx (e.g., a connection failure) while running an exhaust operation can result in creating a new opCtx to cleanup exhaust resources, while the old one is still attached to the client. This triggers a tassert and terminates the connection thread before it can clean up exhaust resources. Consider the following:
- handleRequest notices that the connections is closed, so kills the operation and returns a ConnectionError.
- This translates to calling _onLoopError from here, while the original opCtx associated with WorkItem is still in scope.
- _onLoopError calls into _cleanupSession, which tries to delist the operation but is not successful in this case since it's already killed due to the connection error.
- Next, the thread will call into _cleanupExhaustResources, which attempts to make a new opCtx in order to run killExhaust.
A possible fix is to always destroy the opCtx as part of running _cleanupSession.
|