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

Potential deadlock in an exhaust Cursor destructor

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.12, 4.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Directly calling self.__exhaust_mgr.close() in Cursor.__del__ can lead to a deadlock. In jesse's words:

      It'd require an exhaust cursor to be part of a circular reference that happens to be cleaned up by a GC run triggered while a thread is holding the pool's lock, thus it's so absurdly rare we've never seen it. Nevertheless, we should return an exhaust cursor's socket to the pool in MongoClient._process_periodic_tasks, not synchronously in Cursor.__del__.

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

              Created:
              Updated:
              Resolved: