| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,6 +52,8 @@ jobs: | |||
| 52 | 52 | ||
| 53 | 53 | env: | |
| 54 | 54 | 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 | ||
| 55 | 57 | steps: | |
| 56 | 58 | - name: Checkout code | |
| 57 | 59 | uses: actions/checkout@v7 | |
@@ -84,8 +86,6 @@ jobs: | |||
| 84 | 86 | - name: Embedding tests (Mono/.NET Framework) | |
| 85 | 87 | if: always() | |
| 86 | 88 | 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 | ||
| 89 | 89 | ||
| 90 | 90 | - name: Embedding tests (.NET Core) | |
| 91 | 91 | if: always() | |
@@ -97,7 +97,7 @@ jobs: | |||
| 97 | 97 | ||
| 98 | 98 | - name: Python Tests (Mono) | |
| 99 | 99 | if: always() | |
| 100 | - run: pytest --runtime mono | ||
| 100 | + run: uv run pytest --runtime mono -v -o faulthandler_timeout=60 | ||
| 101 | 101 | ||
| 102 | 102 | - name: Python Tests (.NET Framework) | |
| 103 | 103 | 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 | |||
| 93 | 93 | from immediate segfaults to subtle refcount corruption that crashes much | |
| 94 | 94 | later. | |
| 95 | 95 | ||
| 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 | + | ||
| 96 | 110 | Reference counting and finalizers | |
| 97 | 111 | --------------------------------- | |
| 98 | 112 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments