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

Client can create more than minPoolSize background connections

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 4.0
    • Affects Version/s: None
    • Component/s: None
    • None

      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.

            Assignee:
            julius.park@mongodb.com Julius Park (Inactive)
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: