[GODRIVER-1653] Ensure AbortTransaction can run even if context expires during WithTransaction Created: 16/Jun/20 Updated: 28/Oct/23 Resolved: 19/Aug/20 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.5.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Divjot Arora (Inactive) | Assignee: | Divjot Arora (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
In the WithTransaction code, we use the context passed to WithTransaction to call AbortTransaction. This means that AbortTransaction would fail if the context timed out or was cancelled during the execution of the user-supplied callback and we'd leave an in-progress transaction running after returning. I'm not sure how to best mitigate this. We could run AbortTransaction with context.Background() to ensure it can execute, but this is a deviation from the behavior of contexts because we shouldn't be doing blocking work once the context has expired. |
| Comments |
| Comment by Githook User [ 19/Aug/20 ] |
|
Author: {'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com', 'username': 'divjotarora'}Message: |
| Comment by Divjot Arora (Inactive) [ 14/Aug/20 ] |