[GODRIVER-1812] Panic in Transaction Callback Results in Permanent Write Conflict Created: 16/Dec/20 Updated: 27/Oct/23 Resolved: 17/Dec/20 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | David Wen Riccardi-Zhu | Assignee: | Unassigned |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
I've started to develop our first Transaction with the Go driver (v1.4.4) and an Atlas instance (v4.2.11). I'm quite new to using transactions, so apologies if what follows is not clear. A panic in the function parameter for WithTransaction appears to have resulted in the session not closing. All subsequent transactions are now failing with a Write Conflict – despite the panic being fixed, and a half-hour passing since the panic. Following is what I'm using for my transactions: session, err := client.StartSession() res, err := session.WithTransaction(p.Ctx, p.CB)
The panic occurred in p.CB, above. I would have expected the deferred session.EndSession call to have been called regardless of the panic. But somehow, all subsequent transactions are returning a Write Conflict. What happens if there is no timeout in the context? Does the session remain open indefinitely? |
| Comments |
| Comment by David Wen Riccardi-Zhu [ 16/Dec/20 ] |
|
I think this can be closed – the issue was likely a concurrent update happening without the Session Context, and previously masked by a race condition. |
| Comment by David Wen Riccardi-Zhu [ 16/Dec/20 ] |
|
I have attempted multiple failovers and pausing and restarting my cluster, but all transactions are still returning "Write Conflict". If it's useful, this is what I see with db.serverStatus() for transactions: {{{}} |