[SERVER-40554] The `txn::sendPrepare` utility can return without having destroyed its child AsyncWorkScheduler Created: 09/Apr/19  Updated: 29/Oct/23  Resolved: 15/Apr/19

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.1.11

Type: Bug Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Kaloian Manassiev
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2019-04-22
Participants:
Linked BF Score: 12

 Description   

The Transaction Coordinator's txn::sendPrepare utility instantiates its own child AsyncWorkScheduler in order to be able to cancel just its part of the work without impacting the parent.

The lifetime of this child scheduler has to be shorter than the signaling of the future returned by txn::sendPrepare, so that the caller can use the signaling of the future for controlling the lifetime of its own objects (in this case the entire TransactionCoordinator).

The way it is currently implemented, because prepareScheduler is moved into txn::collect's collector lambda, it will still be alive at the time when the returned future's chain is signaled.



 Comments   
Comment by Githook User [ 15/Apr/19 ]

Author:

{'email': 'kaloian.manassiev@mongodb.com', 'name': 'Kaloian Manassiev', 'username': 'kaloianm'}

Message: SERVER-40554 Get rid of 'lazy' transaction coordinator destruction

And also bound the lifetime of `prepareScheduler` to only until the
collect lambda is signaled.
Branch: master
https://github.com/mongodb/mongo/commit/3275bdb42e57886a671b7af625b9e6b25f6c2e18

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