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

ConnectionClosed events not published when pool is disconnecting

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

      In pool.go, ConnectionClosed events are published in the expiration-checking function and in disconnect for forcefully-closed connections. This doesn't cover all cases though, because connections closed gracefully during disconnect don't go through the expiration checker and connections that encounter network errors manually call pool.removeConnnection on themselves. We can move the event-firing to closeConnection and removeConnection because all cases go through one of those. We'll have to store the reason for closing (e.g. idle, pool closing, etc) on the connection so the event can be published correctly.

       

      The timer variable in pool.disconnect is incorrect. It calculates the time to fire as now-contextDeadline, which will be negative if the deadline is in the future. I don't know why that timer is there at all. I think the ctx.Done() + ticker cases cover everything we need.

            Assignee:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Reporter:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: