File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5252
5353 env :
5454 NUGET_PACKAGES : ${{ github.workspace }}/.nuget/packages
55+ # Apply to every Mono host, including pytest and the .NET Python test runner.
56+ MONO_THREADS_SUSPEND : preemptive # https://github.com/mono/mono/issues/21466
5557 steps :
5658 - name : Checkout code
5759 uses : actions/checkout@v7
8486 - name : Embedding tests (Mono/.NET Framework)
8587 if : always()
8688 run : dotnet test --runtime any-${{ matrix.os.platform }} --framework net472 --logger "console;verbosity=detailed" src/embed_tests/
87- env :
88- MONO_THREADS_SUSPEND : preemptive # https://github.com/mono/mono/issues/21466
8989
9090 - name : Embedding tests (.NET Core)
9191 if : always()
9797
9898 - name : Python Tests (Mono)
9999 if : always()
100- run : pytest --runtime mono
100+ run : uv run pytest --runtime mono -v -o faulthandler_timeout=60
101101
102102 - name : Python Tests (.NET Framework)
103103 if : ${{ matrix.os.category == 'windows' }}
Original file line number Diff line number Diff line change @@ -93,6 +93,20 @@ Forgetting this is the most common pythonnet threading bug. Symptoms range
9393from immediate segfaults to subtle refcount corruption that crashes much
9494later.
9595
96+ Mono thread suspension
97+ ----------------------
98+
99+ On Linux and macOS, Mono's cooperative/hybrid thread suspension can hang
100+ when Python and managed threads interact. If affected, set
101+ ``MONO_THREADS_SUSPEND=preemptive `` before starting the process, as described
102+ in `mono/mono#21466 <https://github.com/mono/mono/issues/21466 >`_.
103+ CI uses this workaround for both embedding and Python-hosted tests.
104+
105+ To run the Mono Python tests with per-test output and a Python thread
106+ stack dump if a test takes longer than 60 seconds::
107+
108+ MONO_THREADS_SUSPEND=preemptive uv run pytest --runtime mono -v -o faulthandler_timeout=60
109+
96110Reference counting and finalizers
97111---------------------------------
98112
You can’t perform that action at this time.
0 commit comments