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

Cleanup connection close logic

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 1.1.2
    • None
    • Core API
    • None

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: