It's possible for an exchange query to crash the server with a use after free due to how we manage memory trackers.
The issue can happen with an Exchange pipeline that uses UnionWith which itself contains a memory tracking stage like setWindowFields. If a consumer other than consumer-0 wins the race to be the first to the first getMore(), then that consumer will be the first one to lazily construct the UnionWith subpipeline. That consumer will end up creating an OperationMemoryUsageTracker that's not created in the normal way. It gets stashed on the client cursor, and when that cursor dies, the memory tracker for the setWindowFields will have a dangling pointer. When other consumers execute the exchange pipeline, there will be a use after free.
- blocks
-
SERVER-132669 Enable memory tracking on the shard side for sharded $search $$SEARCH_META queries
-
- Backlog
-
-
SERVER-132671 Exchange memory tracking should always only report to curOp of consumer0
-
- Backlog
-
-
SERVER-132672 Allow opCtx to keep the memory tracker on detach
-
- Backlog
-
- is related to
-
SERVER-130899 Make $_internalSearchIdLookup inherit from BatchedEnrichmentStage
-
- Closed
-
- related to
-
SERVER-132673 Make memory tracker live on the QueryLifespan
-
- Backlog
-
-
SERVER-132669 Enable memory tracking on the shard side for sharded $search $$SEARCH_META queries
-
- Backlog
-
-
SERVER-132671 Exchange memory tracking should always only report to curOp of consumer0
-
- Backlog
-
-
SERVER-132672 Allow opCtx to keep the memory tracker on detach
-
- Backlog
-