Intermittent access violations during parallel library tests on Windows 11 #1487
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#1487
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?
@Angelifoks on GitHub · 2026-11-24 16:51 UTC · original
xcl-test-failures.zip
Environment
Commit:
037aecd57eOS: Windows 11
CPU: AMD Ryzen 9 9950X3D (32 logical processors)
GPU: NVIDIA RTX 5070 Ti (16 GB)
NVIDIA driver: 610.88
RAM: 64 GB
Rust: 1.100.0
Cargo: 1.100.0
Toolchain: Windows MSVC
Description
Running XCL's library tests with parallel execution intermittently results in test failures and process termination with Windows exception 0xC0000005 (STATUS_ACCESS_VIOLATION).
The full library suite passed with one test thread, and the individual tests that failed during parallel execution passed when isolated.
Reproduction
cargo test -p xcl --lib -- --test-threads=1
cargo test -p xcl --lib
cargo test -p xcl --lib -- --test-threads=16
cargo test -p xcl --lib -- --test-threads=32
Observed results
Sequential run: 707 passed, 0 failed, 21 ignored.
2, 4, and 8 threads: one successful run each.
16 threads: 2 successful runs, 1 access violation.
32 threads: 2 successful runs, 1 access violation.
Default parallelism: 2 crashes in 3 repeated runs.
Failing tests in different runs included:
hle::d3d12x::list_x::tests::write_buffer_immediate_on_open_existing_heap_visible_to_cpu
hle::d3d12x::real::readback_routing_tests::coherent_buffer_sanitizes_console_flags_and_state
An earlier run also reported a failure involving big_compile_tests::a_wanted_build_waits_for_neither_the_slot_nor_the_commit.
At least one readback-routing failure reported assertion left != right failed at real.rs:5584.
Expected behavior
All non-ignored library tests should pass reliably regardless of test-thread count.
Actual behavior
The suite sometimes passes completely, but other runs report differing test failures and terminate with 0xC0000005.
This may involve shared state or timing-sensitive behavior under concurrent test execution, although the root cause is not established.
Additional information
The previously failing readback-routing and big-compile tests both passed when run individually.
Logs are available from the repeated test runs.
github-bot referenced this issue2026-11-26 05:08:04 +00:00
@wileyGray on GitHub · 2026-11-24 17:03 UTC · original · edited 2026-11-24 17:12 UTC
Opened #1520 for the concrete imported-heap test resource leak, also identified in the earlier #175 investigation. Its four transition barriers retained clones in
ManuallyDrop, leaving four resource references when the test freed the backing allocation. The fix borrows the resource through the existing fence waits and checksVirtualFree; all changes are inside the test module.At clean head
6159773d93e826b4c328ad7174334c7a12c75541on Windows 11 Home build 26300, i9-14900K, RTX 4080 SUPER / driver 32.0.16.2114, Rust 1.93.0, DXC 1.9.2609.5, debug,XCL_ADAPTER=NVIDIA, with allXCL_SAMPLE_*unset:(5, 4)references instead of(1, 0)with the old clone behavior; passed after the fix.scripts/test.ps1: 771 passed, 0 failed, 41 ignored. The passing count includes four GPU/debug skips and 33 sample-gated early returns, excluded from executed coverage. Synthetic title e2e passed.real::readback_routing_tests::coherent_buffer_sanitizes_console_flags_and_statetogether with two threads: 20 passed, 0 failed/skipped, no access violations or stalls (0.27-0.36 seconds per pair).This fixes the demonstrated leak, not every intermittent failure reported here. AMD, Intel, Wine/RADV, the reporter's hardware/driver, release, retail titles, and long stress runs remain untested. No proprietary game data or attachments were used. The PR requests maintainer review of the test-only scope for the documented
test-onlysmoke exemption; CI also awaits maintainer approval.AI use: Codex (GPT-6; exact variant unavailable) helped inspect and implement the fix, run validation, and write this report under the user's direction.
@Bullet18x on GitHub · 2026-11-24 18:06 UTC · original
Opened #1590 for the
coherent_buffer_sanitizes_console_flags_and_stateVirtualFree failure that #1523 lists as still open: the shared device is adopted by other tests, so the buffer's last Release goes throughlate_release::holdand the imported heap stays pinned while another test's queue is busy. Deterministic repro and test runs (RTX 5090) are in the PR.@Diskuss on GitHub · 2026-11-24 17:48 UTC · original · edited 2026-11-24 18:36 UTC
Native Windows AMD data point:
AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32015.7029; Ryzen 7 5700X3D; 32 GB RAM; Windows 11 Pro build 26300.9974; Rust 1.100.0 x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug build. Plain origin/main at
9e3831e1f570d3646e53ab753b19ec07eb8f1485, no changes.Results:
write_buffer_immediate_on_open_existing_heap_visible_to_cpu,coherent_buffer_sanitizes_console_flags_and_stateanda_wanted_build_waits_for_neither_the_slot_nor_the_commit, each run alone 10 times withcargo test -p xcl --lib <name>: 30/30 passed, exit code 0 every time, no panic messages.cargo test --workspace --no-fail-fast -- --test-threads=4: 776 passed, 0 failed, 41 ignored; no panics, no access violation, no device removal.The access violations (0xc0000005) did not reproduce on this AMD machine. Limits: the full suite ran only once and at 4 threads, not at the default or 16/32 threads where the report saw crashes, so this is not evidence the race is absent.
Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine.
Update: higher thread counts
The first run above used
--test-threads=4. Here are the runs at the default thread count (16 logical CPUs) and at 32 threads. Setup: same machine, plainorigin/mainatc160d86(it moved on from9e3831esince the first run), no changes, debug build,cargo test --workspace --no-fail-fast, run one after the other.hle::kernelx::tests::a_page_whose_move_fails_stays_mapped_where_it_was(assertion failed: move_away(&mut away, old, at, page, false).is_err()atkernelx.rs:2441)exit code: 0xc0000005, STATUS_ACCESS_VIOLATIONxcl --libtest binary died, so its tests are missing from the counts-p xcl --libtest process crashed with an access violation, so its result line never printed. The counts are only the other test targets, so they are not comparable. No panic message and no failing test name were printed. The last tests that reportedokbefore the crash weregpu::recomp::tests::gpu_split_wave64_local_and_exchanged_masks_in_diverging_wavesandlauncher::tests::never_picks_xcl_itself, which does not show which test crashed. I did not run with--no-capture.SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowswas printed in every run. No device removal was seen.So the access violation does reproduce on this AMD machine, once in 2 runs at 32 threads and 0 of 3 at the default count. It did not appear in the 3 default-thread runs. With 5 runs this is only an anecdote about frequency.
Report written by Claude Code (Claude Sonnet 5.5) from real runs on this machine.
@upipibi on GitHub · 2026-11-24 18:24 UTC · original · edited 2026-11-24 18:37 UTC
The failures in this report, and where each is handled (all test-only):
0xC0000005: #1523.queue_slot_18_before_the_layout_is_known_writes_8_bytesleft a fake fence (0x5EED_0000) in the title-fence bookkeeping, andlist_x's cycle checks then called through it from other tests. It crashed only in parallel runs, and in whichever test was running at the time. Confirmed on an RX 9070 XT and an RTX 5070 by others.coherent_buffer_sanitizes_console_flags_and_state(theleft != rightat theVirtualFreeassert): #1590 (Bullet18x). The buffer's last release goes tolate_release::holdwhile another test's queue has work, so the heap still pins the pages (error 87). (Edited: this pointed to #1628, which dropped that part for #1590.)fine_timer_makes_short_sleeps_short: #1628. A mean of sleeps on a busy PC.I haven't seen
big_compile_tests::a_wanted_build_waits_for_neither_the_slot_nor_the_commitfail here. If it shows up again, its message would help.AI use: Claude Code (Claude Opus 5.5) wrote this.
@coenflict on GitHub · 2026-11-24 18:15 UTC · original · edited 2026-11-24 18:45 UTC
Reproduced the parallel-library-test access violation on clean
mainat9e3831e1f570d3646e53ab753b19ec07eb8f1485, built in a dedicated target directory.Tested
32.0.16.2140, Rust 1.97.1 MSVC, DXC and DXIL 1.9.2602.17, debug,XCL_ADAPTER=nvidia.XCL_SAMPLE_*inputs were unset.cargo test -p xcl --lib -- --test-threads=16 --nocapture, three sequential processes: pass,0xc0000005, pass.--test-threads=32, three sequential processes:0xc0000005,0xc0000005, pass.The final printed test differed among the three crashes. The three tests named in the issue all completed successfully in each passing run, and none printed a completion line in the crashed runs. Those omissions do not identify the faulting thread in parallel output.
I then ran the same clean test binary under a Windows debug-event harness at 32 threads. The first run reproduced a second-chance read violation at
ID3D12Fence::GetCompletedValue(module offset0xf510d9, resolved using the local PDB), reading0x5eed0000. That is the queue-slot-18 fixture's fake fence and independently matches the failure addressed by #1523.Not tested
AI use
gpt-6.2-sol) ran the clean-checkout tests, captured and symbolized the fault, and wrote this report.@Diskuss on GitHub · 2026-11-24 18:58 UTC · original
Where the 0xc0000005 faults on this machine:
xcl::tls::tls_block_of, reading another thread's TEBPlain
origin/mainatc160d86ef2efe3a07e4dfb473e4fa72eafb413c0, debug. AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32015.7029; Ryzen 7 5700X3D (16 logical CPUs); 32 GB RAM; Windows 11 Pro build 26300.9974; Rust 1.100.0 x86_64-pc-windows-msvc.Rates. I ran the lib test binary directly (
target\...\xcl-4ba1c5819800d115.exe <filter> --test-threads=N, cwdcrates/xcl):coherent_buffer_sanitizes_console_flags_and_state(#1590)--skip tls::coherent_buffer_sanitizes_console_flags_and_statetls::only (4 tests)launcher:: loader:: manifest:: modules:: pe:: preflight:: report:: resolver:: rpf shaders:: stubs:: tls:: util:: vfs(87 tests)At about 1 crash in 16 runs, bisecting by module filter cannot separate the filters (0 of 14 proves nothing). The fault address is the better evidence.
Fault address. No debugger is installed (no cdb or procdump). The Windows Application log (event 1000) records the fault offset. My crashing full-lib run at 32 threads faulted at offset
0x9cea6einxcl-4ba1c5819800d115.exe. An earlier crash of axcl-4ba1c5819800d115.exebuild on this machine (19:35, a different build timestamp) has the same offset.llvm-symbolizer(VS Build Tools) maps it through the PDB, anddumpbin /disasmgives the instruction:So the TEB pointer itself is unreadable. That is not a call through #1523's fake
0x5EED_0000fence, which would fault outside the module.Mechanism, reproduced on purpose. In the lib tests,
tls_block_ofonly gets another thread's TEB fromtls::install→fill_existing_threads. That function walks aCreateToolhelp32Snapshotof the process's threads, gets each thread's TEB withOpenThread+NtQueryInformationThread, then readsTEB+0x58. If a thread ends between the query and the read, its TEB is gone and the read access-violates. With 32 test threads plus D3D12 and driver threads starting and ending,tls::tests::windows_loads_carrier_and_allocates_full_block_for_all_threadsandinstall_without_an_index_variablesometimes land in that window.Local experiment, not pushed: an ignored test calls
install2000 times while 8 threads spawn and join empty threads in a loop. It crashed with 0xc0000005 in 1 of 3 runs, at the same instruction:tls_block_of,tls.rs:230,mov rcx,[rax](offset0x7e8fdein that build).The race is not limited to tests:
loader::tls_install→install, andtake_slot_zero(thread_tebs(), then the sameteb.add(0x58)read), can hit it while a title's threads are ending. #1523 may still fix a separate crash.Not done: a full stack (no cdb or procdump without admin), a fix, and a run with #1523 applied.
Investigation by Claude Code (Claude Opus 5.5) on this machine.
@Kalmarv on GitHub · 2026-11-24 19:12 UTC · original
Runs on a Ryzen 9 9950X with an RTX 5070 Ti:
main9e3831eagainst9e3831ewith #1523, #1590, #1600 and #1628 merged together. The four merge cleanly (3 files, +102 −11; local merge745b6f4). The access violation came in 6 of 11 runs onmainand in none of the 10 runs with the four merged.Tested
XCL_DXC_DIR); each side its own privateXCL_DXIL_CACHE, empty before its first run.xcllib test binary of each side (cargo test -p xcl --lib --no-run, clean trees), each run in its own process, the two sides alternating. "Access violation" below is a run that Git Bash reported asSegmentation fault(exit 139) and that printed no test summary.<exe> hle::d3d12x::real:: hle::d3d12x::list_x:: --test-threads=32, 5 runs per side:main9e3831eIn all five
mainrunsqueue_slot_18_before_the_layout_is_known_writes_8_byteshad printedokbefore the process died, which fits #1523's account (its fake fence is called later, from another test). The crashes came 2 s to 155 s into the run.<exe> --test-threads=32:main9e3831e(6 runs)coherent_buffer_sanitizes_console_flags_and_state,real.rs:5825(left: 0, right: 0, theVirtualFreeassert of #1590)coherent_buffer_sanitizes_console_flags_and_statehad already printedFAILEDin itSo on
maintheVirtualFreefailure of #1590 showed in 2 of 6 runs, and in none of the 10 runs with the PRs (5 subset, 5 suite).SKIPPEDlines, bothno wave64.One failure with the four PRs merged, not explained
hle::d3d12x::list_x::tests::write_buffer_immediate_on_open_existing_heap_visible_to_cpupanicked atlist_x.rs:5486withTimeout(2000)(the 2 s fence wait after its second list). That run took 47 s; the other four took 2 to 21 s. The test passed in the other 9 runs with the PRs.list_x.rs. It is one of the tests named in this issue.mainhas the same flake, these runs cannot say: in 4 of the 5mainsubset runs the process died before the test printed a result. Wheremaindid reach it (1 subset run and the 4 suite runs that finished) it passed.Not tested
VirtualFreeassert).fine_timer_makes_short_sleeps_shortpassed in every finished run on both sides here, so these runs do not show the failures those two PRs are for.--test-threads=16, the default thread count, a release build, the other test binaries of the workspace.mainrun hung.AI use: Claude Code (Claude Fable 5.2) made the runs and drafted this. Claude Code (Claude Opus 5.5) reviewed it before posting.
xcl shaders --precompile --only cs --pipelines: access violation in dxcompiler.dll with parallel DXC compiles, not with XCL_DXC_THREADS=1 #2751