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

WaitQueueTimeoutError causes pool to be cleared

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.12, 4.11.3
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Since WaitQueueTimeoutError is a subclass of ConnectionFailure, it causes the pool to be cleared here:

              elif isinstance(error, ConnectionFailure):
                  # "Client MUST replace the server's description with type Unknown
                  # ... MUST NOT request an immediate check of the server."
                  if not self._settings.load_balanced:
                      await self._process_change(ServerDescription(address, error=error))
                  # Clear the pool.
                  await server.reset(service_id)
                  # "When a client marks a server Unknown from `Network error when
                  # reading or writing`_, clients MUST cancel the hello check on
                  # that server and close the current monitoring connection."
                  server._monitor.cancel_check()
      

      https://github.com/mongodb/mongo-python-driver/blob/5ac262783f7fae2bc95ba354aad0ab27d5c23423/pymongo/asynchronous/topology.py#L894-L904

      This is a major bug because WaitQueueTimeoutError should not have side effects. Worse WaitQueueTimeoutError is likely to happen when the system is under heavy load and clearing the pool will likely make that worse.

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: