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

Background thread creates connections while holding the topology lock

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.10
    • Affects Version/s: None
    • Component/s: Internal
    • None

      We should not do any I/O while holding the topology lock but update_pool() holds the lock while (possibly) creating new connections.

          def update_pool(self):
              # Remove any stale sockets and add new sockets if pool is too small.
              with self._lock:
                  for server in self._servers.values():
                      server._pool.remove_stale_sockets()
      

      https://github.com/mongodb/mongo-python-driver/blob/611c3f86b35f8ca4ec3636058030625d2b48562e/pymongo/topology.py#L426-L430

            Assignee:
            prashant.mital Prashant Mital (Inactive)
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: