Skip to content

Crash diagnostics: thread dump at the unhandled exception; XCL_TRACE_ALLOC commit tracer - #164

Open
Sr-0w wants to merge 2 commits into
xcl-dev:mainfrom
Sr-0w:crash-diagnostics
Open

Sr-0w wants to merge 2 commits into
xcl-dev:mainfrom
Sr-0w:crash-diagnostics

Conversation

@Sr-0w

@Sr-0w Sr-0w commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two diagnostics that found the retail title issues fixed in #162 and #163:

  • Thread dump right at the unhandled exception (eh.rs). The retail title's Breakpad keeps the process alive after the crash, so the dump at process exit came late or never. Now the other threads are dumped once, right after report::write_final; that showed which thread the game's watchdog was waiting for.
  • XCL_TRACE_ALLOC=1 (new alloc_trace.rs): detours ntdll!NtAllocateVirtualMemory and counts every commit ≥ XCL_TRACE_ALLOC_MIN bytes (default 1 MiB) under its call stack. Every 15 s it logs the total, the bytes per owning module (first frame outside ntdll / CRT / kernel32 / d3d12), and the top 8 stacks. The detour runs inside heap allocations with the heap lock held, so it takes no lock and allocates nothing (a fixed 4096-slot table of atomics). A first version with a Mutex deadlocked the game. It is off by default and installs nothing then.

On the retail title before #162 it put 20+ GB of commit on amdxc64.dll pipeline compiles.

Test plan

  • cargo build --release
  • Retail title with XCL_TRACE_ALLOC=1: reports every 15 s, no deadlock, game unaffected
  • Retail title crash: thread dump (104 threads) logged right after the unhandled exception

🤖 Generated with Claude Code

@Sr-0w

Sr-0w commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

New commit ce0cb0a: the D3D12 debug-layer relay logged only the first 200 messages, warnings included. The error just before GTA VI's device removal came after hundreds of early warnings and was never logged. Now: the first 200 warnings, and the first 20 errors of each message id.

🤖 Generated with Claude Code

@einfachama

Copy link
Copy Markdown
Contributor

Test report for the commit tracer in #164 at my retail title's first menu, on NVIDIA Ada with 8 GB.

What I tested: 99db9be (thread dump + XCL_TRACE_ALLOC) merged onto main 64b3f35. The PR's second commit ce0cb0a conflicts with main in real.rs, and main already has its own per-id debug-layer cap there, so I kept main's side and did not test ce0cb0a. Local merge commit c5dc444.

Tested

  • NVIDIA GeForce RTX 4060 8 GB (Ada, 32-lane waves), driver 621.24; Ryzen 7 5800X; 32 GB RAM; Windows 11 Pro 26300; Rust 1.100.0 MSVC; DXC 1.9.2602.17; debug for the tests, release for the title runs.
  • cargo test --workspace -- --test-threads=4: 701 passed, 0 failed, 41 ignored, the same as main 64b3f35. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware. The PR adds no test.
  • My retail title, scripts/smoke.ps1 -Seconds 60, unattended (XCL_NETWORK=0), the learned window in both runs:
    • without XCL_TRACE_ALLOC: 1 607 frames, peak commit 14 447 MB, 0 crashes;
    • with XCL_TRACE_ALLOC=1: 1 610 frames, peak commit 14 580 MB, 0 crashes;
    • main 64b3f35 on the same machine: 1 609 and 1 614 frames, 14 575–14 578 MB.
      So the detour costs no frames here, and there was no deadlock.
  • What the tracer reports at the menu (identical at 15, 30, 45 and 60 s): 8.81 GB committed in blocks of 1024 KB or more, 42 call stacks; by module xcl.exe 8.72 GB, nvwgf2umx.dll 0.08 GB, MSTTSEngine_OneCore.dll 0.01 GB. The largest stack is one 4.00 GB block, the size of the coherent window; the next is 2.16 GB in 1 081 blocks.
  • What it does not see: the memory: line puts the process's commit at 14 580 MB at the same moment, so ~5.6 GB is not in the trace. That is about the size of local video memory then (6 142 MB: target pages 3 578, sparse pools 896, arenas 465). uma.rs notes that WDDM charges commit for each video-memory allocation; those charges don't go through NtAllocateVirtualMemory, so I'd expect the tracer to miss them. If that's right, the world-loading growth in Newer retail game on a 32 GB machine: 31 default DXC threads and ~18 GB commit run Windows out of memory #542 / Retail title 1.0.2.1 on RTX 3060 12 GB: world loading never presents, commit 36 GB, local video memory 12.9 GB, then 0xc0000005 in VCRUNTIME140 (memcpy) #646, much of which is target pages and sparse pools, would show up only partly in the trace. I didn't check this past the menu.

Not tested

  • The thread dump at an unhandled exception (no crash happened at the menu).
  • ce0cb0a (see above). World loading: it runs this 32 GB machine out of memory, so I stopped at the menu.
  • AMD / Intel GPUs.

AI use

  • Claude Code with Claude Opus 5.5 ran the builds, tests and title runs in an unattended session and wrote this report from the logs; I checked it before posting.

Sr-0w and others added 2 commits November 25, 2026 14:09
…ALLOC commit tracer

A title crash handler (GTA VI's Breakpad) can keep the process alive for minutes after the
unhandled exception, so the thread dump at exit came late or never: the other threads are
now dumped once, right after the final report.

XCL_TRACE_ALLOC=1 detours ntdll!NtAllocateVirtualMemory and counts every commit of
XCL_TRACE_ALLOC_MIN bytes or more (default 1 MiB) under its call stack; every 15 s the stacks
and modules holding the most are logged. The detour runs inside heap allocations with the heap
lock held, so it takes no lock and allocates nothing (a fixed table of atomics). It showed
GTA VI's 20+ GB coming from amdxc64.dll's pipeline compiles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the first 200 messages

Hundreds of early warnings used the 200 slots; the error before GTA VI's device removal
(CreateUnorderedAccessView of a resource without unordered access) was never logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Sr-0w
Sr-0w force-pushed the crash-diagnostics branch from ce0cb0a to d485841 Compare November 25, 2026 13:09
@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

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

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants