Skip to content

xcl run: a title's minidump of itself is declined, not left to hang - #742

Draft
abilliontokens wants to merge 1 commit into
xcl-dev:mainfrom
abilliontokens:title-minidump-of-itself
Draft

abilliontokens wants to merge 1 commit into
xcl-dev:mainfrom
abilliontokens:title-minidump-of-itself

Conversation

@abilliontokens

Copy link
Copy Markdown

A retail title's crash handler writes a minidump of its own process. Its dump thread calls dbgcore!MiniDumpWriteDump while the crashed thread waits for it. In-process, dbgcore suspends every other thread and then takes the process heap's lock. When one of the threads it suspended holds that lock, the dump never finishes: the process hangs after XCL's crash line, with the window frozen and not responding. It's a race. At the title's world-loading crash (+0x23cf683, #232 / #581) one run ended a second after the crash and the next one hung for minutes.

The title loads dbghelp.dll by name and asks it for MiniDumpWriteDump. This routes that DLL name to a small HLE module (with the real dbghelp.dll as its fallback). Its MiniDumpWriteDump returns FALSE / ERROR_NOT_SUPPORTED for the current process and calls Windows' for any other process. XCL's log already holds the exception and every thread by then (unhandled_filter, hk_nt_terminate_process).

What is in it

  • crates/xcl/src/hle/dbghelp.rs: the module and its test a_minidump_of_the_process_itself_is_declined. Through load_library / get_proc_address as the title calls them, MiniDumpWriteDump is XCL's and declines at once, and SymInitializeW is Windows' own. The test fails without the route: GetProcAddress returns Windows' MiniDumpWriteDump.
  • crates/xcl/src/hle/mod.rs: the module, and the route for dbghelp.dll.

Tested

  • RTX 5060 Ti 16 GB (32-lane waves), driver 621.24; Ryzen 5 7600X; 32 GB RAM; Windows 11 26200; Rust 1.100.0; SDK DXC 1.8.2502.11. Tests in a debug build, title runs in a release build.
  • cargo test --workspace -- --test-threads=4 on a8d712f: 702 passed, 0 failed, 41 ignored. SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64).
  • The hang, on a build of D3D12.X: a console MS in the AS slot is translated as the mesh shader it is #541 + D3D12.X: bound compute pipeline waits so slow compiles do not trip wa… #533 before this change: cdb (-pv) on the hung process showed:
    • every thread suspended once more than cdb itself suspends them;
    • the title's dump thread in dbgcore!MiniDumpWriteDump, waiting in RtlAllocateHeap's critical section;
    • the crashed thread in eh::unhandled_filter → the title's filter → WaitForSingleObject.
  • With this change (f076c50, the same diff before the rebase), a 480 s run that reaches the same crash ends without a hang:
    [  109.451][25436][ERROR] unhandled exception 0xc0000005 in game_scarlett_master.exe+0x23cf683 (write at address 0x0) …
    [  109.456][14040][WARN ] dbghelp: the title's minidump of its own process is not written (an in-process dump can hang the process; XCL's log has the exception and the threads)
    [  109.459][25436][ERROR] process ends with status 0xc0000005 (thread 25436); on the stack:
    
    The process exits with 0xc0000005 8 ms after the crash line.

Regression run
Main f4ce27c:

xcl-smoke v1
commit: f4ce27ceb6d1b0576d0c659b713b674778bf1968
gpu: NVIDIA GeForce RTX 5060 Ti
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 2484 (PresentX 2484)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15473 MB

This PR a8d712f:

xcl-smoke v1
commit: a8d712f1ecfcd0fff2b3755841306d343f98929e
gpu: NVIDIA GeForce RTX 5060 Ti
title: ScarlettGame
seconds: 90
exit: 0x0
frames shown: 2470 (PresentX 2471)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15585 MB

Not tested

  • The hang can't be forced on demand: it depends on which thread holds the heap lock at the crash. I ran the fixed build to the crash once; the old build hung on one of two crashes.
  • AMD.
  • Titles that write a dump of another process (they get Windows' MiniDumpWriteDump unchanged).

AI use
Claude Code (Claude Opus 5.5) found the hang with cdb, wrote the change and the test, ran the tests and runs above on my machine, and drafted this description.

A retail title's crash handler wakes its dump thread, which calls
dbgcore!MiniDumpWriteDump on its own process while the crashed thread waits
for it. In-process, dbgcore suspends every other thread and then takes the
process heap's lock. When one of the suspended threads holds that lock, the
dump never finishes: the process hangs after XCL's crash line, the window
frozen and not responding.

Seen at the title's world-loading crash (+0x23cf683) on an RTX 5060 Ti: one
run ended a second after the crash, the next hung for minutes. cdb on the hung
process showed every thread suspended once more than cdb itself suspends them,
the dump thread in dbgcore!MiniDumpWriteDump waiting in RtlAllocateHeap's
critical section, and the crashed thread in XCL's unhandled filter -> the
title's filter -> WaitForSingleObject.

The title loads dbghelp.dll by name and asks it for MiniDumpWriteDump. It is
now routed to a small HLE module whose MiniDumpWriteDump returns FALSE with
ERROR_NOT_SUPPORTED for the current process and calls Windows' for any other.
The rest of dbghelp is Windows' own. XCL's log already holds the exception and
every thread by then.

Assisted-by: Claude Code (Claude Opus 5.5)
@crosettiremi

Copy link
Copy Markdown

Tested #742 at a8d712f on a Radeon RX 7900 XT, Windows 11 build 26100, in a local integration build. The title reached its Series S account picker, accepted the scripted A press, displayed loading artwork and later hit the world-loading watchdog. The host exited on its own and preserved the original exception status.

Local run Outcome
Before #742 The title wrote its report after a read access violation at 141.016 s. The host was still frozen more than 40 s later and needed manual termination.
With #742 The watchdog raised 0xc0000005 at title+0x23cf683 at 191.747 s. XCL logged the declined self-dump at 191.766 s and the process exit at 191.793 s, 46 ms after the exception. The launcher returned 0xc0000005.

The two runs faulted at different instructions. This verifies the self-dump and exit behavior on AMD. World loading still crashes. The fixed run recorded 1,718 presents and zero device removals.

The integration workspace reported 731 passed, 0 failed and 41 ignored, including the new self-dump test passing. One counted pass printed a runtime skip because xgameruntime.dll was unavailable for the debug-layer draw test.

Codex (GPT-6) ran the local tests and prepared this report.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
Integrates upstream PR xcl-dev#742: route dbghelp!MiniDumpWriteDump and
decline self-process minidumps so crashes exit cleanly instead of
deadlocking on process heap locks.
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
Integrates upstream PR xcl-dev#742: route dbghelp!MiniDumpWriteDump and
decline self-process minidumps so crashes exit cleanly instead of
deadlocking on process heap locks.
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
Integrates upstream PR xcl-dev#742: route dbghelp!MiniDumpWriteDump and
decline self-process minidumps so crashes exit cleanly instead of
deadlocking on process heap locks.
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
Integrates upstream PR xcl-dev#742: route dbghelp!MiniDumpWriteDump and
decline self-process minidumps so crashes exit cleanly instead of
deadlocking on process heap locks.
@Foniass

Foniass commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Test report: #742 at a8d712f on NVIDIA, native Windows – 0 hangs in 8 crashes; main alone hung in 2 of 11

Tested

  • This PR's head a8d712f merged onto main beaa245 (local merge, no conflicts), against main beaa245 alone. Release builds for the title runs, debug for the tests.
  • RTX 5070 Ti 16 GB (driver 32.0.16.2114, 32-lane waves), Ryzen 7 7800X3D, 31 GB RAM + a fixed 64 GB page file, Windows 11 build 26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17 (Windows SDK).
  • Retail title 1.0.2.1, XCL_NETWORK=0 XCL_ACTIVITY=1, scripted input (XCL_PRESS_A_AT, A every 3 s from 20 s). Every run loads the story and ends in the title's watchdog abort at +0x23cf683, 97.6–104.6 s after start.
Build Runs that reached the abort Hung after the crash line Crash line → process ends line
main beaa245 11 2 (still frozen 2.7 and 3.5 min after the crash line; killed by hand) 767–1031 ms in the 9 that exited
beaa245 + #742 8 0 12–15 ms
  • With xcl run: a title's minidump of itself is declined, not left to hang #742 every run logs dbghelp: the title's minidump of its own process is not written (…) 3–5 ms after the crash line. XCL's process ends line and its thread dump follow as before, and the exit status is still 0xc0000005.
  • The title's reporter still goes on to its upload step afterwards; XCL_NETWORK=0 refuses it (WinHttpConnect fails (no network)).
  • cargo test --workspace -- --test-threads=4 on the merged tree: 714 passed, 0 failed, 41 ignored. SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64). hle::dbghelp::tests::a_minidump_of_the_process_itself_is_declined passes.

The hang on main, from a minidump of one hung run (taken from another process, unwound with the modules' .pdata; ntdll, KERNELBASE and xcl.exe match the files on disk). It is the deadlock this PR describes, with a different lock holder:

  • the crashed thread: eh::unhandled_filter → the title's filter → WaitForSingleObject(…, INFINITE) on the semaphore its dump thread releases;
  • the title's dump thread: dbgcore!MiniDumpWriteDump → GetFileVersionInfoSizeExW → RtlReAllocateHeap, waiting for a heap's lock;
  • a render worker of the title, in that heap's allocator: bind::set_pipeline_state → pso_async::resolve_wait → real::build_compute → finish_pso → CreateComputePipelineState → nvgpucomp64 → RtlAllocateHeap (35 KB).

At this abort the title's render workers are seconds into driver compiles of compute pipelines, which fits how often it hangs here.

Not tested

  • AMD and Intel GPUs; Windows 10; this PR's head on its own base (only the merge onto beaa245).
  • A title that loads dbgcore.dll itself, or whose filter blocks on something other than its own dump.
  • The 60 s smoke pair: the description already has one.

Runs, dump analysis and this report by Claude Code (Claude Fable 5.2, with Claude Opus 5.5 agents) on the machine above; every number is from the logs of those runs.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
Integrates upstream PR xcl-dev#742: route dbghelp!MiniDumpWriteDump and
decline self-process minidumps so crashes exit cleanly instead of
deadlocking on process heap locks.
@Anon64

Anon64 commented Nov 24, 2026

Copy link
Copy Markdown

Independent confirmation of the cause from a hung process, plus a run of this PR on a 12 GB NVIDIA card.

Setup: RTX 3060 12 GB (581.80, wave32), Windows 11 26200, 64 GB RAM, release builds. World load with A pressed every 4 s from 20 s, XCL_NETWORK=0 XCL_PSO_PRELOAD=0. XCL_SLEEP_HOLD=0, so the title's watchdog fires again at its +0x23cf683 write. On today's main, #1288 holds the watchdog back during a pipeline wait, and the crash this PR is about no longer happens there by default.

main 689f2db, the hang:

  • 1 hang in 6 crashes. The host stayed at ~19 GB with no frames, and the log ended at the unhandled exception line with no process ends line.
  • cdb attached to the hung host (the child xcl.exe, not the xcl run launcher):
    • the crashing thread is in xcl!xcl::eh::unhandled_filter+0x9ec, inside the title's filter, which waits in KERNELBASE!WaitForSingleObjectEx;
    • all 169 other threads of the host are suspended (suspend count 1 besides the debugger's).
  • This is what your description says: the dump thread suspends everything else, and the crashed thread waits for it.
  • On the crashes that did end, process ends came about 0.6 s after the crash line.

This PR's head a8d712f merged onto main 20cf130 (clean merge):

  • 10 world runs, 0 hangs; every process ended on its own.
  • In a timed run, process ends came 14 ms after the crash line (102.778 s → 102.792 s).
  • The loop polled every 5 s, so in 7 of the 10 runs the process had already ended before it saw the crash line. It saw that line in the other 3, and the timed run above crashed and ended the same way.

On the side: before finding this PR I tried a 10 s deadline on the title's filter from a thread in the host. It cannot work for this case, because the title's filter suspends that thread too. Declining the dump, as here, avoids the wait altogether.

Not tested: the full suite on this head; AMD.

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants