Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-2460

Client can create more than minPoolSize background connections

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Component/s: None
    • Labels:
      None

      Description

      Noticed this bug when working on PYTHON-2395 where MongoClient can create more than minPoolSize background connections.

      active_sockets is the count of checked out connections. As part of clearing the connection pool, pool.reset() resets the "active_sockets" count to 0. However, if we reset the count to 0 when a connection is checked out then active_sockets will become negative when the connection is eventually checked back in. For example (pseudocode):

      conn = pool.checkout() 
      # active_sockets == 1
      pool.clear()
      # active_sockets == 0
      pool.checkin(conn)
      # active_sockets == -1
      

      Luckily the only thing active_sockets is used for is maintaining minPoolSize connections. So the only side effect of this bug is that the client might create more than minPoolSize connections.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              julius.park Julius Park
              Reporter:
              shane.harvey Shane Harvey
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: