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

Segmentation fault on Windows with Free-Threaded Python

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • 4.12
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers

      Detailed steps to reproduce the problem?

      While working on PYTHON-4840, I saw the following behavior on Windows:

      $ pip install -e .
      $ python -q -X faulthandler
      >>> import pymongo
      Windows fatal exception: access violation
      
      Current thread 0x00000598 (most recent call first):
        File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
        File "<frozen importlib._bootstrap_external>", line 1316 in create_module
        File "<frozen importlib._bootstrap>", line 813 in module_from_spec
        File "<frozen importlib._bootstrap>", line 921 in _load_unlocked
        File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
        File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
        File "<frozen importlib._bootstrap>", line 1415 in _handle_fromlist
        File "C:\cygwin\home\Administrator\mongo-python-driver\bson\__init__.py", line 147 in <module>
        File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
        File "<frozen importlib._bootstrap_external>", line 1022 in exec_module
        File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
        File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
        File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
        File "<frozen importlib._bootstrap>", line 1310 in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
        File "C:\cygwin\home\Administrator\mongo-python-driver\pymongo\asynchronous\mongo_client.py", line 61 in <module>
        File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
        File "<frozen importlib._bootstrap_external>", line 1022 in exec_module
        File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
        File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
        File "C:\cygwin\home\Administrator\mongo-python-driver\pymongo\__init__.py", line 91 in <module>
        File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
        File "<frozen importlib._bootstrap_external>", line 1022 in exec_module
        File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
        File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
        File "<python-input-0>", line 1 in <module>
        File "C:\python\Python313\Lib\code.py", line 92 in runcode
        File "C:\python\Python313\Lib\_pyrepl\console.py", line 205 in runsource
        File "C:\python\Python313\Lib\code.py", line 313 in push
        File "C:\python\Python313\Lib\_pyrepl\simple_interact.py", line 160 in run_multiline_interactive_console
        File "C:\python\Python313\Lib\_pyrepl\main.py", line 59 in interactive_console
        File "C:\python\Python313\Lib\_pyrepl\__main__.py", line 6 in <module>
        File "<frozen runpy>", line 88 in _run_code
        File "<frozen runpy>", line 198 in _run_module_as_main
      Segmentation fault
      

      There is no core dump available.

      Definition of done: what must be done to consider the task complete?

      Diagnose the segmentation fault and support free-threaded Python on Windows.

      The exact Python version used, with patch level:

      3.13.0 experimental free-threading build (tags/v3.13.0:60403a5, Oct 7 2024, 09:53:29) [MSC v.1941 64 bit (AMD64)]

      The exact version of PyMongo used, with patch level:

      https://github.com/mongodb/mongo-python-driver/commit/27039c30bf6bd3e8167d084597cde28eb82a526f

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      N/A

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      CYGWIN_NT-10.0-17763 EC2AMAZ-AK1GT57 3.5.3-1.x86_64 2024-04-03 17:25 UTC x86_64 Cygwin

      windows-64-vsMulti-small spawn host.

      Web framework or asynchronous network library used, if any, with version (e.g. Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)

      N/A

      Security Vulnerabilities

      N/A

            Assignee:
            Unassigned Unassigned
            Reporter:
            steve.silvester@mongodb.com Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: