[SERVER-46238] Race between commitTransaction and transaction expiration leads to invariant Created: 18/Feb/20 Updated: 29/Oct/23 Resolved: 25/Feb/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | 4.0.16 |
| Fix Version/s: | 4.0.17 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Tess Avitabile (Inactive) | Assignee: | Jason Chan |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||||
| Steps To Reproduce: | Add a sleep to the commitTransaction command:
Then run the following test:
|
||||||||||||||||||||||||||||||||||
| Sprint: | Repl 2020-03-09 | ||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||||||||||||
| Description |
|
The following race leads to invariant failure: The startPeriodicThreadToAbortExpiredTransactions thread kills the commitTransaction operation here. It then marks the transaction state as aborted here. The commitTransaction operation gets interrupted and triggers an abort-guard here. However, since the transaction state was already marked as aborted, we skip the destruction of the WriteUnitOfWork here. This means that the commitTransaction operation is still in a WriteUnitOfWork when it waits for writeConcern, triggering this invariant. This only occurs on 4.0, due to a refactor on 4.2, where transaction state can only be modified by the thread that checked out the session. |
| Comments |
| Comment by Githook User [ 25/Feb/20 ] |
|
Author: {'username': 'jasonjhchan', 'name': 'Jason Chan', 'email': 'jason.chan@mongodb.com'}Message: |