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

ConnectionClosed events not published when pool is disconnecting

    XMLWordPrintable

    Details

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

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            divjot.arora Divjot Arora
            Reporter:
            divjot.arora Divjot Arora
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: