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

Background thread creates connections while holding the topology lock

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.10
    • Internal
    • None

    Description

      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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: