Uh oh!
There was an error while loading. Please reload this page.
Add the concurrency stress test that reproduces #175 - #176
Merged
Conversation
Eight simulations in threads, each required to reproduce the fire node count it produces when run alone, plus a case hammering object construction to exercise the shared id counter. Skips when the GIL is on, since every call into the extension is serialised there and no race can show. Under PYTHON_GIL=0 on a free-threaded interpreter it segfaults or returns wrong counts, which is the point: it gives the shared-state work in #175 a failing test to fix. Deliberately not wired into CI. On an ordinary interpreter it would skip and report green while proving nothing; it earns a job once it can pass for the right reason. Refs #175
This was referenced Aug 12, 2026
HugoFara
commented
Aug 12, 2026
CollaboratorAuthor
Test/doc only, merging myself. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The reproduction harness for #175, plus the documentation for running it. No changes to
src/.Eight threads, each building a 1000×1000 domain with the
Isopropagation model, igniting at the centre and stepping five times. Each thread must reproduce the fire node count it produces when run alone. A second case hammers object construction, which draws every id from one shared counter.What it measures
Built from source against CPython 3.14.6 free-threading in a manylinux_2_28 container:
dev@e1df887dev+ the small fixes proposed in #175The GIL-on column is the control: identical workload, identical code, passing every time. The only variable is whether the calls are serialised.
The one crash-free run on
devis the interesting one:Wrong answers rather than a crash, which is the worse failure of the two.
Deliberately not wired into CI
On an ordinary interpreter the GIL serialises every call into the extension, so the test skips and exits 0. A CI job would sit green while proving nothing — the same failure mode as a warning nobody reads. It earns a job at the end of #175, once it can pass for the right reason. Please do not add one as a follow-up before then.
PYTHON_GIL=0is required rather than optional:_pyforefiredoes not declarepy::mod_gil_not_used(), so importing it switches the GIL back on, and the test would otherwise skip on a free-threaded interpreter too. It says so when that happens rather than passing quietly.What this does not do
It does not fix anything. It fails on
dev, and it is meant to. Merging it makes the problem in #175 reproducible on demand; the fixes are separate pull requests, and by the measurements above only the full state refactor makes it pass.TESTING.mdgains a section covering the interpreter requirement, the invocation, and the fact that it currently fails.This pull request, including its code changes and this description, was generated by Claude Opus 5, and reviewed manually before submitting.