Skip to content

CI: [diagnostic, do not merge] Test pytest without xdist (isolate execnet thread) - #707

Closed
echoix wants to merge 1 commit into
mainfrom
ci-diag/no-xdist-single-process
Closed

echoix wants to merge 1 commit into
mainfrom
ci-diag/no-xdist-single-process

Conversation

@echoix

@echoix echoix commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Purpose

Sixth diagnostic in this investigation. Ruled out so far:

  • Every dumpbin export/import diff of the changed OSGeo4W packages
    (gdal313-runtime, python3-gdal, curl, openssl, libjpeg-turbo, expat)
    and grass_gis.8.6.dll's own dependency chain (proj_9.dll, curl,
    sqlite3, tiff.dll/jpeg62.dll) -- all clean, no removed exports or
    broken ordinals.
  • PROJ unchanged since April 2026.
  • Downgrading the MSYS2 mingw-w64 toolchain snapshot -- still crashes.
  • A single, isolated from grass.pygrass import utils import -- no
    crash.
  • Sequentially importing all 22 grass.lib.* ctypes submodules in one
    process -- no crash (rules out a raw DLL-count/TLS-slot-exhaustion
    theory).

Yet the exact same grass_gis.8.6.dll load crashes with

Windows fatal exception: code 0xc0000139

every time under pytest-xdist. The one thing left that's different:
pytest-xdist's execnet transport runs a background thread for
worker I/O alongside the thread doing test collection (and therefore
ctypes loading). 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.

What this PR does

Runs two of the known-failing test files (test_i_gensig.py,
lib/arraystats/tests) directly through plain pytest, with no
-n/xdist argument at all, right before the existing full parallel
run (which is left untouched as a same-run comparison baseline).

If this single-process run passes, it strongly implicates
pytest-xdist/execnet's threaded worker transport specifically,
not pytest or GRASS's ctypes bindings in general.

This PR is for CI investigation only and is not meant to be merged.

🤖 Generated with Claude Code

…rge)

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 <noreply@anthropic.com>
@echoix echoix closed this Oct 1, 2026
@echoix
echoix deleted the ci-diag/no-xdist-single-process branch October 1, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant