Potential deadlock in an exhaust Cursor destructor

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 3.12, 4.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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
              Reporter:
              Shane Harvey
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: