[SERVER-36911] Ensure that cluster aggregations that fail clean up cursors Created: 28/Aug/18  Updated: 29/Oct/23  Resolved: 04/Oct/18

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 4.1.4

Type: Bug Priority: Major - P3
Reporter: Kyle Suarez Assignee: Nicholas Zolnierz
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
is duplicated by SERVER-37150 Aggregation with $out can leak a curs... Closed
Related
related to SERVER-36482 Add mapping of namespace to ChunkVers... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query 2018-09-24, Query 2018-10-08
Participants:
Linked BF Score: 4

 Description   

When setting up a non-passthrough cluster aggregation, mongos establishes cursors on the targeted shards that will be used by the merging portion of the pipeline. We must ensure that, if the aggregation fails during planning, we appropriately clean up cursors and do not leak them.

As part of this work, we'll also write tests that deliberately force a failure and assert that cursors are cleaned up appropriately.



 Comments   
Comment by Githook User [ 04/Oct/18 ]

Author:

{'name': 'Nick Zolnierz', 'email': 'nicholas.zolnierz@mongodb.com', 'username': 'nzolnierzmdb'}

Message: SERVER-36911: Relax assertions in agg cleanup test to fix failures on slow machines
Branch: master
https://github.com/mongodb/mongo/commit/bfadbd1d340278e056547c9b94160e51410cfced

Comment by Githook User [ 04/Oct/18 ]

Author:

{'name': 'Nick Zolnierz', 'email': 'nicholas.zolnierz@mongodb.com', 'username': 'nzolnierzmdb'}

Message: SERVER-36911: Ensure that cluster aggregations that fail clean up cursors
Branch: master
https://github.com/mongodb/mongo/commit/68fe3afd3b7b3037a18deea5c063256027e5e029

Comment by Charlie Swanson [ 19/Sep/18 ]

For the record, we noticed that one of our new $out tests added a scenario that would leak a cursor. If parsing fails on the shards but not on the mongos - we will leak the cursors from the first ('shards') half of the pipeline. This shouldn't usually happen, but it can happen in rare cases where extra validation checks are performed during parsing (like verifying the collection is not sharded) that can have different results on the shards vs. the mongos.

Comment by Kyle Suarez [ 05/Sep/18 ]

For now, we're going to keep this in the $out epic but will put it on the backlog. While it's true that an $exchange would cause more cursors to be open (and therefore have a bigger impact in the event they were leaked), this is a condition that exists today. The latest plan will not cause stale sharding metadata exceptions to be raised during cluster aggregation planning after cursors have been established.

Generated at Thu Feb 08 04:44:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.