Repository navigation
Description
What
nanopynix.EvalState(store, [], fetch_settings=...) aborts when it runs in a
child that pytest-forked created. The abort is an uncaught C++ exception:
the C stack ends in libstdc++ and then abort.
tests/nanopynix/bindings/test_flake.py .Fatal Python error: Aborted
Current thread ... (most recent call first):
File "tests/nanopynix/bindings/test_flake.py", line 128 in test_the_evaluator_refuses_a_dirty_tree_when_allow_dirty_is_off
...
File ".../pytest_forked/__init__.py", line 68 in runforked
File ".../py/_process/forkedfunc.py", line 65 in _child
Line 128 is the EvalState construction itself, and not the lock_flake
call after it.
Evidence that the fork is the cause
Both runs use the same runner,
nanopynix-tests-nix_2_34-nogc, and the same store backend:
| run | selection | result |
|---|---|---|
| forked | TestGitFetcherSettings |
1 passed, 2 aborted |
--in-process-evaluator=run |
TestGitFetcherSettings |
3 passed |
73 of 75 tests of the wider subset (tests/nanopynix/core and
tests/nanopynix/bindings/test_flake.py) pass under the fork. The two that
abort are the two that build an EvalState with their own fetch_settings,
rather than taking the session-scoped eval_state fixture.
Why this matters
These two tests are the acceptance test of #64. TestGitFetcherSettings
holds the stack-use-after-return of #63, which is the defect the ASAN job
exists to catch.
It also blocks a route that would otherwise close a gap in #76. A build with
no collector leaks by design, so tests/support/nix_runtime.py skips every
test that builds an evaluator in the pytest process. A fork per test would
give the memory back and let the whole in-process subset run under ASAN. That
route is closed while this abort stands, and --in-process-evaluator=fork
carries the mode with the failure documented.
What is not yet known
- The exception is not named.
terminate called after throwingdoes not
reach the log, so the next step is to catchstd::terminateor to run the
child under a debugger. - Whether the fork is unsafe in general, or only after the parent process has
reached a particular state. The parent runs collection only, and collection
callsnanopynix.build_info(). - Whether
fetch_settingsis the discriminator, or whether a second
EvalStatein one process is.
Whether this reaches a consumer is the first question to answer. A library
that aborts in a forked child is a defect of the library and not of the test
harness, and a consumer that forks would meet the same abort.
Acceptance criteria
- The exception is named, and the cause is stated.
- Either an
EvalStateconstructs in a forked child, or the reason it cannot
is recorded where a consumer will read it.
Tests
TestGitFetcherSettingsunder--in-process-evaluator=fork, against a
no-collector build.
Activity
test(nogc): add a fork mode for the in-process tests, and record why …
test(nogc): fork every in-process test, and drop the second ASAN run
fix(nanopynix): give the evaluator a collector, and fork a contract p…