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

disconnect() doesn't unblock threads waiting on connection pool

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.8, 3.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible

      A MongoClient calls disconnect() to reset its connection pool (and other state), whenever it loses its connection to MongoDB. MongoReplicaSetClient calls disconnect() to resets its connection pools for all replica set members. Users might also call disconnect() directly, on either client class.

      If threads are waiting for sockets from the connection pool(s) they must be unblocked by disconnect() so they can attempt to open new sockets. Currently they remain blocked on the max_pool_size semaphore. They'll be awakened the next time a socket is checked in.

      If the thread that calls disconnect(), then does an operation, it will open a new socket, check it in, and unblock the waiters. But if it doesn't, and all other threads are already blocked, the application deadlocks.

            jesse@mongodb.com A. Jesse Jiryu Davis
            jesse@mongodb.com A. Jesse Jiryu Davis
            0 Vote for this issue
            1 Start watching this issue