[SERVER-57653] ReshardingDonorOplogIterator must call Pipeline::dispose() if Pipeline::getNext() throws Created: 11/Jun/21  Updated: 29/Oct/23  Resolved: 15/Jun/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 5.0.0-rc2, 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Max Hirschhorn
Resolution: Fixed Votes: 0
Labels: PM-234-M3, PM-234-T-oplog-apply, post-rc0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
related to SERVER-57654 Call Pipeline::dispose() if Pipeline:... Closed
related to SERVER-57655 Call Pipeline::dispose() if Pipeline:... Closed
is related to SERVER-56437 ReshardingDonorOplogIterator destroys... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0
Sprint: Sharding 2021-06-28
Participants:
Linked BF Score: 170
Story Points: 1

 Description   

If this call to Pipeline::getNext() throws, then it is possible for the PlanExecutor underlying the Pipeline's DocumentSourceCursor to still be holding locks while the OperationContext is destructed.

We should add a guard around the call to ReshardingDonorOplogIterator::_fillBatch() to call Pipeline::dispose() if Pipeline::getNext() throws.

auto guard = makeGuard([&] { pipeline->dispose(opCtx); pipeline.reset() });
pipeline->reattachToOperationContext(opCtx);
auto doc = pipeline->getNext();
pipeline->detachFromOperationContext();
guard.dismiss();



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 16/Jun/21 ]

Author:

{'name': 'Max Hirschhorn', 'email': 'max.hirschhorn@mongodb.com', 'username': 'visemet'}

Message: SERVER-57653 Dispose Pipeline in ReshardingDonorOplogIterator on error.
Branch: SERVER-34632
https://github.com/mongodb/mongo/commit/f82785b6cb6075d3087e8af2545689764064d4a9

Comment by Githook User [ 15/Jun/21 ]

Author:

{'name': 'Max Hirschhorn', 'email': 'max.hirschhorn@mongodb.com', 'username': 'visemet'}

Message: SERVER-57653 Dispose Pipeline in ReshardingDonorOplogIterator on error.

(cherry picked from commit f82785b6cb6075d3087e8af2545689764064d4a9)
Branch: v5.0
https://github.com/mongodb/mongo/commit/e2fba06768ba16225951ec0735ec1665e4a549c9

Comment by Githook User [ 14/Jun/21 ]

Author:

{'name': 'Max Hirschhorn', 'email': 'max.hirschhorn@mongodb.com', 'username': 'visemet'}

Message: SERVER-57653 Dispose Pipeline in ReshardingDonorOplogIterator on error.
Branch: master
https://github.com/mongodb/mongo/commit/f82785b6cb6075d3087e8af2545689764064d4a9

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