Repository navigation
Description
Three tests fail in test-asan-nix_2_34, test-asan-nix_2_35 and
test-asan-git, and they are the only failures in those jobs:
FAILED tests/nanopynix/test_scalar_accessor_semantics.py::test_inproc_reports_runaway_recursion_at_nixs_default_depth[local] - :-1: running the test CRASHED with signal 0
FAILED tests/nanopynix/test_engine_parity_semantics.py::test_engines_agree_on_failure[local-runaway_recursion] - :-1: running the test CRASHED with signal 0
FAILED tests/nanopynix/test_scalar_accessor_semantics.py::test_rpc_reports_runaway_recursion_at_nixs_default_depth[local] - nanopynix.exceptions.WorkerDiedError: Connection lost
= 3 failed, 1694 passed, 18 skipped, 1 xfailed, 26 warnings in 1153.59s
ASAN says what it is:
==22022==ERROR: AddressSanitizer: stack-overflow on address 0x7b4fb70199e8 (pc 0x7b4fc2aba290 bp 0x7b4fb701b2c0 sp 0x7b4fb7019910 T3)
Why the tests exist, and why ASAN loses
test_scalar_accessor_semantics.py:394-404 states the contract: at Nix's
default max-call-depth of 10000, the recursion needs about 27 MB of C stack.
The evaluator thread therefore gets the 60 MiB that nix::initNix() asks
for, so Nix's own counter wins the race against the C stack. The comment
8000
also says what a regression looks like, and it is what happened here: the
test does not fail, the process dies.
ASAN gives each frame redzones and stops the compiler from reusing stack
slots, so the same 10000 frames no longer fit in 60 MiB. The guard is
calibrated for a build with no instrumentation.
Proven pre-existing, and version-dependent
Run 30907694264
is develop at 689ec37c, with no branch work on it. It fails exactly
test-asan-nix_2_34, test-asan-nix_2_35 and test-asan-git, and nothing
else: {"failure": 3, "skipped": 2, "success": 22}.
test-asan-nix_2_31 passes both tests in the same matrix:
tests/nanopynix/test_scalar_accessor_semantics.py::test_inproc_reports_runaway_recursion_at_nixs_default_depth[local] PASSED
tests/nanopynix/test_scalar_accessor_semantics.py::test_rpc_reports_runaway_recursion_at_nixs_default_depth[local] PASSED
So the cost of an eval frame grew between 2.31 and 2.34, and 60 MiB stopped
being enough under ASAN somewhere in that step. Find the change before you
pick a number.
Two ways to correct it, and what each costs
- Give the evaluator thread more stack under ASAN. This keeps the test
doing its job in the ASAN job as well. It needs a measurement of the real
frame cost under ASAN, and a rule for where the number comes from, rather
than a constant that the next Nix version invalidates again. - Skip the three tests under ASAN. This is cheap and it is honest, and
it removes ASAN coverage of the one path that is about the stack.
Option 1 is the better answer if the number can be derived. Do not weaken
the assertion in either case.
The marker cannot express this yet
nix_known_issue(exclude=..., sanitizer=...) is the marker for a bounded
defect, and sanitizer="asan" is already accepted. _version_in_exclusions
(tests/support/nix_runtime.py:197) matches a version prefix only, so
there is no way to write "2.34 and later". A skip would have to list every
version, and the list would be wrong the day a new one arrives.
Acceptance criteria
test-asan-nix_2_34,test-asan-nix_2_35andtest-asan-gitfinish with
no failure.- The reason the tests pass is written down: either the stack number and
where it comes from, or the skip and the marker that carries it. - If the marker gains a version range,
tests/meta/gains the self-check
for it.
Activity
Lillecarl commentedon Aug 4, 2026
Option 1 is not available. The stack is not what runs out.
I built the ASAN runner for 2.34 and reproduced the failure locally in 3.2
seconds, then swept the evaluator stack size. More stack does not fix it.
It moves the failure.
SEGV on unknown address 0x03e8001e3b49, a WRITECHECK failed: asan_thread.cpp:369The change of failure between 60 and 120 MiB is what proves the knob took
effect.
What happens at and above 120 MiB
Nix's counter does win the race at that point. It throws
max-call-depth, and the C++ exception unwinds out of 10000 frames. Theunwind calls
__asan_handle_no_return, and ASAN then fails a CHECK insideits own thread bookkeeping:
Every frame from #0 to #38 is inside
libasan.so. Nothing Nix or nanopynixdoes decides the outcome.
Note the size ASAN reports for the thread stack: 85790400 bytes, or about
82 MiB, at both 120 and 240 MiB. ASAN's record of the evaluator thread's
bounds does not follow
threading.stack_size(), so the recursion runs offthe stack ASAN believes in, and its own machinery then walks memory that is
not a frame.
detect_stack_use_after_return=0does not help either. Measured, bypatching a copy of the runner, since the runner exports
ASAN_OPTIONSitself:
with the same CHECK failure.
So the three tests are skipped under ASAN
nix_known_issue(sanitizer="asan", reason=...)now marks the two intest_scalar_accessor_semantics.pyand therunaway_recursioncase of theparity matrix. The reason each carries names this issue.
This is not "ASAN is slow" or "ASAN is noisy". The premise of the tests is
that Nix's counter can win the race against the C stack. Under ASAN the
counter wins and the unwind fails, so there is no stack size at which the
tests can pass, and no assertion in them that could be made true.
The marker gained the bound it needed, and lost a defect on the way
nix_known_issuerequiredexclude, so a defect of the instrumentation hadno way to say so. It now takes
exclude, orsanitizer, or both, andrefuses a marker that gives neither -- a marker with no bound skips
everywhere and never comes back.
While adding the self-check for that I found
_version_in_exclusionsinverted. It compared
padded()on both sides, andpaddedonly everadds parts. So
"2.34"meant the two-part version 2.34 and never matcheda released 2.34.8 -- while a Nix built from git reports
2.35pre2026...,which parses to exactly
(2, 35)and did match"2.35".Every exclusion in the tree is written with two parts, so this was not
theoretical.
test_inproc_mixed_evaluation_build_and_store_workloadscarried:
and did the opposite of what it says. Measured in runs 30930842932 and
30934106841:
test-tsan-nix_2_34test-tsan-nix_2_35test-tsan-gitThe matcher now compares at the precision of the exclusion, so
"2.34"meansthe 2.34 series. The marker itself is removed rather than corrected: a
corrected one would skip all three builds, and the runs above say the test
passes under TSAN on both released versions.
tests/meta/test_known_issue_marker.pypins all of this.
test(asan): skip the runaway-recursion tests, which libasan cannot un…
Lillecarl commentedon Aug 4, 2026
The three skips are in, and the ASAN matrix is green
Run 30940324091, on
ci-develop, withnix_known_issue(sanitizer="asan")onthe two tests in
test_scalar_accessor_semantics.pyand on therunaway_recursioncase of the parity matrix:test-asan-nix_2_31test-asan-nix_2_34test-asan-nix_2_35test-asan-gitThe three failures were the same three in run 30934106841 and in run
30907694264 on
develop, so this is the first run in which every ASAN jobpasses.
The issue stays open. The skips record a defect of the instrumentation, and
they come back the day a libasan can unwind out of
max-call-depth. Themeasurement that says no stack size helps is in the comment above.
test(asan): skip the runaway-recursion tests, which libasan cannot un…
Lillecarl commentedon Aug 5, 2026
All acceptance criteria hold. Measured on run
31055578130,
the full matrix on
developat09fa83eb: 27 jobs green, 0 failures.1. "
test-asan-nix_2_34,test-asan-nix_2_35andtest-asan-gitfinishwith no failure." All three, and
test-asan-nix_2_31as well. Nostack-overflowreport in any of them.The last ASAN failure was a different defect -- the host
/bin/shoftest_store_dump_db.pyunder the sanitizerLD_PRELOAD-- and it has its ownissue, #121, now closed. That is why these jobs stayed red after the skip
landed.
2. "The reason the tests pass is written down." Option 2, and the reason
option 1 was rejected is written down with it.
tests/nanopynix/test_scalar_accessor_semantics.py:405-412carries the sweep:So no stack number answers this. The failure is inside libasan, and neither
Nix nor nanopynix decides it.
_ASAN_CANNOT_UNWINDis the marker thatcarries the skip, and the three tests report it:
3. "If the marker gains a version range,
tests/meta/gains the self-checkfor it." Not applicable, and deliberately so. The marker did not gain a
range.
sanitizer="asan"needs no version list, which is what the issue saida version list would get wrong the day a new Nix arrives.
abc3da693f0fseparately corrected
_version_in_exclusionsto match at the precision ofthe exclusion, but that is prefix matching and not a range.
What it costs
test-asan-nix_2_31used to pass these two tests, and it skips them now. Themarker is version-blind, so ASAN coverage of the one path that is about the
stack is gone on every version rather than on the versions that need it. That
is the price the issue named for option 2, and it is paid knowingly.
Closing.
test(scalar): let the cyclic-conversion test skip on 2.36 under ASAN
test(asan): skip the runaway-recursion tests, which libasan cannot un…
test(scalar): let the cyclic-conversion test skip on 2.36 under ASAN