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

Document that client.close cannot be called from __del__

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Docs
    • None

      Summary: The Pymongo client seems to be causing a deadlock when `.close()` is called:

      Environment:

      • 3.8.12 (default, Jan 15 2022, 18:39:47) [GCC 7.5.0]                            
      • Pymongo version: 4.1.1
      • Pymongo has c: True

      Description:

      We've found that any of our scripts that use a utility to wrap a pymongo class won't exit properly. They hang in a deadlock. Ultimately getting stuck trying to restart a monitor thread here.

      We've found this started happening for us when upgrading from python 3.6.9 to 3.8.12. We've also found this happens for any python 3.9.* or 3.8.*. 

      Impact on us:

      This is preventing our company from upgrading from python 3.6.9 which is blocking features we would like to release.

      Attached script instructions:

      1. Follow the instructions here to install a mongodb server.
      2. In a python environment install the attached `pip_deps.txt` list.
      3. Run `python example_for_mongo.py`.
      4. Watch the script get stuck in deadlock.

        1. example_for_mongo.py
          0.5 kB
          _david.evans@bluerivert.com
        2. pip_deps.txt
          5 kB
          _david.evans@bluerivert.com

            Assignee:
            Unassigned Unassigned
            Reporter:
            david.evans@bluerivert.com David Evans
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: