From 1f15b1ac4f3db90cd7f3933cc27b118d10a33fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 26 Sep 2026 09:50:41 -0400 Subject: [PATCH] CI: Test pytest without xdist to isolate execnet's thread (not for merge) A single, isolated `from grass.pygrass import utils` and a sequential import of every grass.lib.* submodule both succeed in one process (see the sibling diagnostic PRs), yet the same loads crash with Windows fatal exception: code 0xc0000139 under pytest-xdist. This rules out a raw DLL-count/TLS-slot-exhaustion theory (loading all 22 grass.lib submodules sequentially in one process didn't crash), leaving pytest-xdist's own worker mechanism as the remaining suspect: execnet runs a background thread for worker I/O alongside the thread doing test collection/ctypes loading, and Windows' DLL loader is known to be fragile under concurrent/ multi-threaded LoadLibrary calls (loader-lock contention), which can surface as a spurious "entry point not found" even when nothing is actually missing. This runs two of the known-failing test files directly through plain pytest, with no -n/xdist argument at all, to see if skipping execnet's threaded worker transport avoids the crash. Temporary, for CI investigation only. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/osgeo4w.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index 96b5a6bb9aa..6ffd951ef2c 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -133,6 +133,30 @@ jobs: pytest-randomly # Obfuscated usage of GitHub Actions features, Windows CMD shell limits analysis shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" # zizmor: ignore[misfeature] + + - name: "[CI diagnostic, not for merge] Single-process pytest (no xdist) reproduction test" + # A single, isolated `from grass.pygrass import utils` and a + # sequential import of every grass.lib.* submodule both succeed + # in one process (see the sibling diagnostic PRs), yet the same + # loads crash with "Windows fatal exception: code 0xc0000139" + # under pytest-xdist. pytest-xdist's execnet transport runs a + # background thread for worker I/O alongside the thread doing + # test collection/ctypes loading, and Windows' DLL loader is + # known to be fragile under concurrent/multi-threaded + # LoadLibrary calls (loader-lock contention), which can surface + # as a spurious "entry point not found" even when nothing is + # actually missing. This runs a couple of the known-failing + # test files directly through plain pytest, with no `-n`/xdist + # argument at all, to see if skipping execnet's threaded + # worker transport avoids the crash. + run: | + call %OSGEO4W_ROOT%\opt\grass\etc\env.bat + set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH% + path %GISBASE%\lib;%GISBASE%\bin;%PATH% + pytest -v imagery/i.gensig/testsuite/test_i_gensig.py lib/arraystats/tests + # Obfuscated usage of GitHub Actions features, Windows CMD shell limits analysis + shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}"" # zizmor: ignore[misfeature] + - name: Run pytest with multiple workers in parallel run: | call %OSGEO4W_ROOT%\opt\grass\etc\env.bat