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

Client can create more than minPoolSize background connections

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • None
    • 4.0
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: