Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1812

Panic in Transaction Callback Results in Permanent Write Conflict

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Gone away
    • Icon: Major - P3 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?

      Attachments

        Activity

          People

            Unassigned Unassigned
            davidwen.riccardizhu@gooduncle.com David Wen Riccardi-Zhu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: