Details
-
Bug
-
Resolution: Gone away
-
Major - P3
-
None
-
None
-
None
-
None
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()
{{ if err != nil {}}
panic(err)
{{ }}}
{{ defer session.EndSession(p.Ctx)}}
res, err := session.WithTransaction(p.Ctx, p.CB)
{{ if err != nil {}}
return err
{{ }}}
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?