Skip to content

CI: [diagnostic, do not merge] Count sequential grass.lib loads before crash - #706

Closed
echoix wants to merge 1 commit into
mainfrom
ci-diag/sequential-lib-load-count
Closed

echoix wants to merge 1 commit into
mainfrom
ci-diag/sequential-lib-load-count

Conversation

@echoix

@echoix echoix commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Purpose

Fifth diagnostic in this investigation. A single, isolated
from grass.pygrass import utils (which loads grass_gis.8.6.dll)
does not crash in a fresh process (confirmed in
ci-diag/standalone-import-test), but the same load crashes with

Windows fatal exception: code 0xc0000139

under pytest-xdist. Every dumpbin export/import diff of
grass_gis.8.6.dll's dependency chain (proj_9.dll, curl, sqlite3,
tiff.dll/jpeg62.dll) came back clean -- see the other sibling
diagnostic PRs -- and downgrading the MSYS2 mingw-w64 toolchain
snapshot didn't fix it either. This points away from a single missing
symbol and toward a resource-count issue tied to how many DLLs
accumulate as loaded within one process (e.g. a Windows/MinGW
TLS-slot exhaustion, since libgomp and other mingw-w64 runtime DLLs
use TLS).

What this PR does

Adds .github/workflows/ci_diag_sequential_lib_load.py, which imports
every grass.lib.* ctypes submodule one at a time in a single
process, flushing progress after each import (with faulthandler
enabled so a crash mid-way still leaves a stack trace in the log).
Run right after the existing grass86.bat smoke tests, before
pytest/xdist starts.

This should show exactly how many (and which) sequential ctypes
library loads it takes to reproduce the crash within a single
process -- or confirm it doesn't reproduce at all regardless of how
many are loaded, which would point back toward something specific to
pytest-xdist itself (e.g. execnet's worker/thread setup) rather than
a pure DLL-count effect.

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

🤖 Generated with Claude Code

…or merge)

A single, isolated `from grass.pygrass import utils` (which loads
grass_gis.8.6.dll) does not crash (see the sibling
ci-diag/standalone-import-test PR), but the same load crashes with
"Windows fatal exception: code 0xc0000139" under pytest-xdist, and
every dumpbin export/import diff of grass_gis.8.6.dll's dependency
chain came back clean (see the other sibling diagnostic PRs). This
points to a resource-count issue (e.g. a Windows/MinGW TLS-slot
exhaustion, since libgomp and other mingw-w64 runtime DLLs use TLS)
rather than a single missing symbol.

This imports every grass.lib.* ctypes submodule one at a time in a
single process, flushing progress after each import, to find exactly
how many (and which) sequential loads it takes to reproduce the
crash, or whether it doesn't reproduce at all in a single process
regardless of count.

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/sequential-lib-load-count branch October 1, 2026 00:21
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