Tests: the lib test binary sometimes ends with 0xc0000005 during eh::tests::thread_dumps_while_threads_run_and_exit #3586
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-01T16:14:03Z.
In full parallel suite runs, the lib test binary sometimes ends with
0xc0000005(STATUS_ACCESS_VIOLATION) whileeh::tests::thread_dumps_while_threads_run_and_exitis taking its dumps. That test came with #253, which fixed #2689. No test is named as failing, so the run looks like an unexplained crash of the whole binary. I have seen it on two trees here.What happened
main6bfb5c5(today):cargo test --workspace --no-fail-fast -- --test-threads=4ended withprocess didn't exit successfully: ...xcl-<hash>.exe --test-threads=4 (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION).mainb2b1f10(earlier today): the same exit, in the same place.xcl: thread dump (N threads)blocks and then ended. A passing run of the test prints 40.churn_stackthreads, deep in their recursion.gpu::agility::tests::create_device_sets_dred_first(insidewintrust/CRYPT32, called fromnvwgf2umx.dll),gpu::bvh::tests::scene_trace_matches_brute_forceandgpu::dxil::compact_tests::a_large_program_that_repeats_itself_takes_the_compact_form. NVIDIA driver threads were in the process too.What did not reproduce it
--exact eh::tests::thread_dumps_while_threads_run_and_exit): 30 of 30 passed.eh::tests::,gpu::agility::tests::,gpu::bvh::tests::andgpu::dxil::compact_tests::together at--test-threads=8: 20 of 20 passed.6bfb5c5at--test-threads=4: no access violation. One run hit the knownxma2_source_voice_decodes_and_manages_lifetimeassertion, and one ended at thecoherent window could not be restoredstop from #3187.Not found
I did not find the cause. The process ends without a crash message, so the faulting thread and address are unknown. #253's notes list "a dump that reads deeper than the copy" as not covered. Another candidate is a module unloading between the copy and
RtlLookupFunctionEntry/RtlVirtualUnwind. A driver thread that ends after it is resumed, for example, could let its module unload. Neither has been checked.It matters outside the tests, because
XCL_THREAD_DUMP_ATand the thread dump taken when a process ends with a non-zero status both call the samedump_threads.Hardware: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300, debug build.
AI use
eh.rs, and wrote this issue.Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-01T17:23:48Z.
Two more sightings today, both on #1852's head (
1fbdea9, which changes onlygpu/dxil) merged ontomain6bfb5c5. Two whole-suite runs in a row ended the lib binary with0xc0000005, after 7 and after 5 of the test's 40 dumps. As before,gpu::agility::tests::create_device_sets_dred_firstandgpu::bvh::tests::*were running beside it.The lib binary run on its own afterwards (
--test-threads=4) did not hit it: 0 of 4 runs onmain, 0 of 4 on the merge. So far: 4 crashes in about 23 whole-lib runs here. All 4 came in acargo test --workspacerun, which starts the lib binary right after the build.AI use: Claude Code (Claude Opus 5.5) made the runs and wrote this comment.
Update, 17:55 UTC: one more, on #3476's merge (
sparse.rsonly), after 7 dumps. Today's tally here: 5 of the 22cargo test --workspaceruns I made today ended this way, against 0 of 19 runs of the lib binary started on its own. In every crashcreate_device_sets_dred_firstwas running beside the dump test. In 3 of the 5 last dumps its stack was inside the NVIDIA driver (nvwgf2umx.dll), and in 1 of them insidewintrust/CRYPT32too.Update, end of day (counted from the saved logs, not from memory): 8 of the 44
cargo test --workspaceruns here today ended this way, each after 5 to 10 of the 40 dumps, each withcreate_device_sets_dred_firstbeside it. The lib binary started on its own did it too, once in 20 runs (on #3475's merge, after 5 dumps). So it is not only a suite-start effect, as my earlier line suggested.Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-02T19:16:13Z.
Cause found: a DLL is unloaded while the dump is unwinding a frame inside it. The fix below works here. I cannot open it as a PR myself: it changes the runtime, and this machine has no retail title for the smoke pair. Anyone who has one is welcome to take it as is.
How I reproduced it. Each run started the lib test binary from a freshly named copy, with
eh::tests::thread_dumps gpu::agility gpu::bvh gpu::dxil::compact gpu::dxil::cfg --test-threads=4. Onmain817eb1f4 of 104 runs ended with the access violation (64 of those runs had the recorder below built in).Where it faults. A temporary exception handler on the dumping thread recorded two of them, both in
eh::unwind:UNWIND_INFO(*info.add(3)). The address was no longer readable, and the frame's address was not in any loaded module.RtlLookupFunctionEntryinntdll.dll, again for a frame that was not in any loaded module.The stack is copied while the thread is stopped, but the thread then runs on, and the DLL its frame is in can be unloaded before the unwind data is read. This fits what every crash had in common:
create_device_sets_dred_firstwas running beside it, with driver and system DLLs on its stack.XCL_THREAD_DUMP_AT, and the dump when a process ends with an error, use the same code.Fix.
unwindtakes a reference to the module before it reads a frame's unwind data and gives it back afterwards. If the address is in image memory that is no longer a module, the walk of that thread ends there. Title images areVirtualAllocmemory, so their frames are kept.maincargo test --workspace --no-fail-fast -- --test-threads=4with it, onc53e969: 3005 passed, 0 failed, 52 ignored, 25 SKIPPED (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps).Limits. The new test is a race, so without the fix it fails only about 1 run in 7, by crashing the test binary. If the dump ends up holding the last reference, the DLL's unload runs on the dumping thread. Not tested: a dump in a real title. #2923 changes the same function for a different fault and does not hold the module, so the two would need merging by hand.
Patch against
c53e969(crates/xcl/src/eh.rs, +62)Hardware: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300, debug build.
AI use: Claude Code (Claude Opus 5.5) found the cause, wrote the patch and the test, made the runs and wrote this comment.