GeezerVison is showing github.com — CI: intermittent hard crash of `cython` while building the limited API test extensions on Windows · Issue #32473 · numpy/numpy
CI: intermittent hard crash of cython while building the limited API test extensions on Windows #32473DescriptionDescribe the issue
Since 2026-09-01, Windows CI jobs intermittently fail in the test_limited_api.py fixture. meson compile -vv fails because one of the ~35 parallel cython processes spawned by ninja dies with exit code 3221356611 and no stderr:
[29/175] "cython" "-M" "--fast-fail" "-3" "-I" "...\site-packages\\" "--module-name" "limited_api_cython_3_13_npy2_0" .../limited_api_cython.pyx -o limited_api_cython_3_13_npy2_0.pyd.p/limited_api_cython.pyx.c
FAILED: [code=3221356611] limited_api_cython_3_13_npy2_0.pyd.p/limited_api_cython.pyx.c
ninja: build stopped: subcommand failed.
3221356611 is 0xC0020043 = RPC_NT_INTERNAL_ERROR. That is an OS-level process crash, not a Cython error. Which module variant dies varies from run to run, and reruns usually pass.
Examples
Steps to reproduce
I tried to reproduce this on my Windows 11 PC using the same dependencies as the failing jobs, but didn't see any problems. I've only seen this happen on github runners. It may be a problem with the runners themselves. Activityrgommers commented on Sep 3, 2026 Looks like a process dying when the OS runs out of memory. Windows is worst case for this test I think. Limiting to -j4 should help. kumaraditya303 commented on Sep 3, 2026 I am wondering if the real problem is that with xdist each worker ends up running its own meson compile, and each of those spawns ninja with the default n+2 jobs, so on a 4 core runner -n auto gives 24 jobs in total so the OS runs out of memory. rgommers commented on Sep 3, 2026 It shouldn't, since it's a single (parametrized) test - that should be landing in a single process.
Re job count: unfortunately ninja uses n_vcpu + 2 and n_vcpu may be 2*n_physical on x86-64 with hyper-threading. It's a bad default, and I'm not sure what happens on GitHub runners, but it's possible on a regular CPU to get 10 jobs scheduled on a 4-core CPU. Which ends badly on lower-end laptops with 8 GB RAM. rgommers commented on Sep 3, 2026 Also IIRC the compilation fixture is module-scoped, and reused - so it should be a pytest/pytest-xdist bug if it's built more than once. kumaraditya303 commented on Sep 3, 2026 I tried adding prints to install_temp fixture to check how many times it gets called and with n=2 I see two different calls.
diff --git a/numpy/_core/tests/test_limited_api.py b/numpy/_core/tests/test_limited_api.py
index 94b1175fc6..4cedf6fe87 100644
--- a/numpy/_core/tests/test_limited_api.py
+++ b/numpy/_core/tests/test_limited_api.py
@@ -44,6 +44,7 @@ def install_temp(tmpdir_factory):
# the comment above _PY_ABI3_VERSIONS below.
if not HAS_SUBPROCESSES:
pytest.skip("No subprocess")
+ print(f"Running meson build in {tmpdir_factory.getbasetemp()}")
# Build against a copy of the sources placed next to the build dir:
# meson refers to sources via paths relative to the build dir, and on
bringing up nodes...
bringing up nodes...
.....................................................................s. [100%]
==================================== PASSES ====================================
________________ test_limited_api_abi3[limited_api_3_9_npy2_0] _________________
[gw0] darwin -- Python 3.14.7 /Users/kumaraditya/.cache/uv/builds-v0/.tmpD2lBTm/bin/python
---------------------------- Captured stdout setup -----------------------------
Running meson build in /private/tmp/claude-501/-Users-kumaraditya-work-numpy/b9edb500-28bc-472a-9b1b-7d120ef2a335/scratchpad/pt/popen-gw0
1.12.0
________________ test_limited_api_abi3[limited_api_3_10_npy2_1] ________________
[gw1] darwin -- Python 3.14.7 /Users/kumaraditya/.cache/uv/builds-v0/.tmpD2lBTm/bin/python
---------------------------- Captured stdout setup -----------------------------
Running meson build in /private/tmp/claude-501/-Users-kumaraditya-work-numpy/b9edb500-28bc-472a-9b1b-7d120ef2a335/scratchpad/pt/popen-gw1
1.12.0 LeonxLJX commented on Sep 4, 2026 rgommers commented on Sep 4, 2026 You're right @kumaraditya303 - I looked into it a bit more, and it's a documented limitation of pytest-xdist.
I had an LLM take a closer look, and the suggestions were about pytest-xdist grouping so tests get scheduled in the same process:
pytestmark = [
pytest.mark.skipif(cython is None, reason="requires cython"),
pytest.mark.xdist_group("limited_api_build"),
]
# Then execute tests with: `pytest -n auto --dist=loadgroup`
I don't like that much though, because it's yet more abstraction, and because the extra --dist=loadgroup will not be enforced so users can still run into this.
The better fix is to just not parametrize the test, but make it a single test, something like:
def test_limited_api(tmp_path):
install_dir = build_limited_api_extensions(tmp_path)
for version in versions:
for module_name in module_names:
module = import_extension(install_dir, version, module_name)
check_limited_api(module)
The test parametrization isn't relevant here - it's a single test over a set of 35 extension modules, and none should fail anyway or there's a real problem - and the one minor benefit of parametrize (identifying the versions that are failing) usually won't apply. We saw that in the last failure: it depends on Cython version, so all 35 tests failed at once. rgommers commented on Sep 4, 2026 @LeonxLJX stop posting direct output of an LLM. This is against our AI policy. Do not do that on any open source project, or you'll get banned. kumaraditya303 commented on Sep 4, 2026 I created #32501 to combine all test into one so that meson is run once. ngoldbaum commented on Sep 4, 2026 #32501 should have fixed this so I'm closing. I'll re-open it if I notice weird crashes along the lines of the issue description in the future. ngoldbaum commented on Nov 3, 2026 kumaraditya303 commented on Nov 3, 2026 I think it is related to python/cpython#159118, _wmi is used by cython when querying about platform (found by Claude).
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|