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

Cleanup connection close logic

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.1.2
    • Affects Version/s: None
    • Component/s: Core API
    • Labels:
      None

      For the topology.Connection type, we release the server's semaphore in the Close and Expire methods, but only set the underlying connection to nil if there are no errors. This could lead to a semaphore being released too many times if the following happens:

      1. Close is called. Semaphore is released once but there is an error putting the connection back in the pool, so the underlying connection is not set to nil.

      2. Close is called again. The semaphore is released again, causing a panic.

      To fix this, we should move the line that sets connection to nil higher up so that it always happens and avoids a panic.

            Assignee:
            isabella.siu@mongodb.com Isabella Siu (Inactive)
            Reporter:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: