SERVER-131596ClosedFixed

mongos segfaults disposing a sharded merge cursor with a detached OpCtx

A sharded aggregation crashes mongos during cursor teardown: {{MergeCursorsStage::doDispose()}} calls {{BlockingResultsMerger::kill()}} with a null OperationContext. *Trigger* mongos fills a batch with a count-bounded loop: for (long long objCount = 0; objCount < batchSize; ++objCount) { next = ccc->next(); ... } The crash needs the results to exactly fill the final batch (count == batchSize) with the cursor then at EOF. The loop stops on the count bound without ever pulling the trail

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix
9.1.0-rc09.0.0-rc18.3.16
Components
Server components related to this issue

No components specified.

Labels
Tags and classification
bkpdino-extensions-api-90-burndown