[SERVER-62710] AsyncRequestsMerger won't attempt to cleanup shard cursors when deadline is exceeded Created: 18/Jan/22  Updated: 29/Oct/23  Resolved: 15/Mar/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Jordi Serra Torrens Assignee: Romans Kasperovics
Resolution: Fixed Votes: 0
Labels: query-director-triage, quick-tech-debt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File repro-server-62710.patch    
Issue Links:
Depends
is depended on by SERVER-43099 Reenable random chunk migration failp... Closed
Related
is related to SERVER-46255 establishCursors/AsyncRequestsSender ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

repro-server-62710.patch

Sprint: QE 2022-02-21, QE 2022-03-07, QE 2022-03-21
Participants:

 Description   

In a sharded cluster, when the client performs a find, mongos will open a set of cursors on the shards and pass them to RouterStageMerge. When the mongos is done with the cursors (exhausted, errored, etc.) RouterStageMerge:kill will get invoked, which will end up calling AsyncResultsMerger::kill. There, _scheduleKillCursors will attempt to invoke killCursors onto the shards.

This is a best-effort – we ignore any failures. However, in the the event of a MaxTimeMSExpired failure, because in the mongos the opCtx deadline is also expired, this best-effort killCursors won't even get scheduled because the executor will immediately timeout when attempting to get a connection from the pool. This will leak the shard cursors.

Attached repro script.



 Comments   
Comment by Githook User [ 15/Mar/22 ]

Author:

{'name': 'Romans Kasperovics', 'email': 'romans.kasperovics@mongodb.com', 'username': 'romanskas'}

Message: SERVER-62710 Ensure that AsyncResultsMerger attempts to kill shard cursors when maxTimeMs is exceeded
Branch: master
https://github.com/mongodb/mongo/commit/80421c5b8e5ac71e16dc005fd961901884891c47

Generated at Thu Feb 08 05:55:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.