Test suite: parallel cargo test intermittently dies with 0xc0000005 (hle::d3d12x queue_tests × list_x race) #1978
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#1978
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?
@DavidM1911 on GitHub · 2026-11-25 00:20 UTC · original
What happened
cargo test -p xcl --libintermittently kills the whole test process with0xc0000005 STATUS_ACCESS_VIOLATIONwhen tests run in parallel. Single-threaded (-- --test-threads=1) always passes. This makes every PR verification flaky — roughly 1 in 3 full-suite runs dies.Minimal reproduction (Windows 11, RTX 3060 Ti,
main@1d027e5)The narrowed pair crashes 3/3 runs in ~seconds; adding
--test-threads=1passes (28 tests ok).hle::d3d12xas a whole crashes every time; each submodule alone passes.Bisect notes:
hle::crashes;gpu::,shaders::,vfs,pe::,memory, and every otherhle::submodule pass.hle::d3d12x: only the combination ofreal::queue_tests(1 test:queue_slot_18_before_the_layout_is_known_writes_8_bytes) with thelist_xgroup reproduces it —queue_testsalone passes, eachlist_xhalf alone passes,queue_tests+ either half oflist_xpassed once but the fulllist_xset crashes consistently.ID3D12Device/command-list/queue creation andWait64BitValueX … bridged to GPU queue.Waitactivity — looks like a race in shared D3D12.X state (device/queue/fence or the kernelx GPU-view map) between concurrently running tests, not a logic bug in any single test.Why it matters
Every contributor running the suite hits this; PR reports keep having to say "flake, passes single-threaded". A
#[serial]-style guard around the GPU-touchinghle::d3d12xtests, or fixing the shared state, would make the suite trustworthy again.@DavidM1911 on GitHub · 2026-11-25 00:27 UTC · original
Follow-up: likely root cause found.
crates/xcl/src/hle/d3d12x/real.rskeeps the console-layout detection in process-global atomics:QUEUE_SHIFTED(real.rs:5463) — set forever once any queueSignal/Wait-shaped call carries a fence (queue_dispatch, real.rs:5496), and read live bymake_layout_splitwhen a command-list vtable is built (real.rs:818).QUEUE_OLDER(real.rs:5467) — same idea for the older layout.queue_tests::queue_slot_18_before_the_layout_is_known_writes_8_bytesresets both flags and asserts on them, whilelist_xtests drive real queue Signal/Wait traffic that flipsQUEUE_SHIFTEDmid-run. Two failure modes:make_layout_splitreads&QUEUE_SHIFTEDwhile constructing a vtable; if the flag flips between slot mappings, one vtable can end up with mixed old/new slot numbering → a console call lands on the wrong PC function → the 0xc0000005. In production the flip is supposed to happen once, early — but a title callingSignalon one thread while another thread is still creating command lists hits the same window.So this may not be only a test-isolation problem; the layout detection probably wants to be settled before any command list is built (or the flag read once per vtable, consistently).
@JJAutoCompare on GitHub · 2026-11-25 00:34 UTC · original
This overlaps the access violation tracked in #1487 and the open test-only PR #1523. Current
main@6567c5fstill supplies a bare integer as a fence in the reported queue test. The synchronization graph can retain that test value and query it from another test thread. #1523 replaces it with a process-lifetime fake fence whose completion query is valid. I confirmed the PR merges cleanly into that main revision. Queue test · Earlier diagnosis and independent runsThe flag resets still create test interference. One correction to the production hypothesis:
make_layout_splitcaptures both targets plus a reference to the flag. The thunk reads that flag at call time, so a flip during vtable construction does not freeze a mix of old and new targets. The next useful comparison here is the same paired test filter at the reported base with and without #1523. This was a source review, without a local reproduction of the crash. Layout dispatch · Assisted by Codex (gpt-6.2-sol).@upipibi on GitHub · 2026-11-25 00:43 UTC · original
Measured on an RTX 3070 (Windows 11, driver 616.56, debug) with
cargo test -p xcl --lib -- cpu_writes q_release queue, which takes inreal::queue_testsand thelist_xcross-queue tests, at the default thread count:main80f48190xc000000543a0130(unrelated to this)0xc0000005main80f4819+ #15231362129Single-threaded,
mainpasses every time. So the unmapped0x5EED_0000fence fromqueue_slot_18_before_the_layout_is_known_writes_8_bytesis the whole cause here, and either #1523 or #2002 removes it. #2002 also clears the test's entries afterwards. Only one of them should merge.AI-assisted (Claude Code). Synthetic tests only.
..in a console path stops at its mount's root #1170xcl preflight— the environment checks without starting a game #1064