[GODRIVER-2997] WithTransaction completes despite a context cancelation Created: 26/Sep/23 Updated: 18/Dec/23 Resolved: 09/Oct/23 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.12.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Preston Vasquez | Assignee: | Preston Vasquez |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Documentation Changes: | Not Needed | ||||||||||||
| Documentation Changes Summary: | 1. What would you like to communicate to the user about this feature? |
||||||||||||
| Description |
|
When running Session.WithTransaction, the BAAS team are seeing data being committed to the database despite a context cancelation. The BAAS team is issuing the transaction with the code here: https://github.com/rukumar333/baas/blob/BAAS-24930/realm/sync/server/transactionbroker/registry.go#L414 The error being returned by the WithTransaction is
The BAAS team uses this fork of the Go Driver in production: https://github.com/mongodb-forks/mongo-go-driver/tree/release/v1.10.7-baas Edit: Pairing with rushil.kumar@mongodb.com , we can re-create the issue by adding the following code above the "CommitLoop" on either the BAAS fork or the v1 Go Driver branch:
This will result in errors such as the following:
The Go Driver documentation for Session.WithTransaction notes that you should not use the method with a cancelable context:
Open question for triage: Is this a Go Driver bug? |
| Comments |
| Comment by Githook User [ 08/Nov/23 ] |
|
Author: {'name': 'Steven Silvester', 'email': 'steven.silvester@ieee.org', 'username': 'blink1073'}Message: Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com> |
| Comment by Githook User [ 10/Oct/23 ] |
|
Author: {'name': 'Steven Silvester', 'email': 'steven.silvester@ieee.org', 'username': 'blink1073'}Message: Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com> |
| Comment by Preston Vasquez [ 04/Oct/23 ] |
|
The Go Driver could use a non-cancelable context before the commit loop. This would prevent cancelation after the closure but before the operation completely executes and commits. |