[SERVER-71649] Transaction API shouldn't block on an uncancelable operation Created: 28/Nov/22  Updated: 29/Oct/23  Resolved: 12/Dec/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 6.2.0-rc1, 6.3.0-rc0
Fix Version/s: 6.3.0-rc0

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

Issue Links:
Related
related to SERVER-70247 SyncTransactionWithRetries used with ... Closed
is related to SERVER-72287 Make transaction API wait for best ef... Closed
is related to SERVER-72413 Split may return an error when it is ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:
Linked BF Score: 35

 Description   

After callers of the synchronous internal transaction API are interrupted, the cancellation token of the transaction is canceled and the caller waits for the transaction to complete uninterruptibly to guarantee the callback provided to the API has completed and its referenced variables are still in scope. This relies on the assumption that cancelling the token for the transaction will soon complete the transaction.

SERVER-70247 fixed an issue where cancelling the transaction API will prevent the API from best effort aborting its transaction, leading to wasted resources. The fix made the best effort abort always use an uncancelable cancellation token. The API still forces callers to wait for the best effort abort to complete before returning though, so if the abort hangs, the caller will hang as well.

This can trigger a deadlock if the caller of the API holds a resource like a SessionCatalog session for a different session than the transaction uses (e.g. if the caller uses the transaction API from an AlternativeClientRegion) that can prevent a stepdown from completing which may block the abort command when it tries to take the RSTL before running.

A possible fix is to refactor the API so it does not block the caller waiting for the best effort abort.



 Comments   
Comment by Githook User [ 12/Dec/22 ]

Author:

{'name': 'Jack Mulrow', 'email': 'jack.mulrow@mongodb.com', 'username': 'jsmulrow'}

Message: SERVER-71649 Refactor Transaction API to not wait for an uncancelable abort
Branch: master
https://github.com/mongodb/mongo/commit/06b2332b5eedc7c733c4376a34df34d4018b253c

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