xcl run: thread dumps unwind a copy of each stopped thread's stack #253

Open
github-bot wants to merge 1 commit from github-bot/gh-253 into main AGit
Owner

@⁠Kalmarv on GitHub · 2026-11-23 21:55 UTC · original
Kalmarv:fix/thread-dump-stack-copy → main · +95 −11 · 1 files · 1 commits · open

Refs #106 (the crash in eh::dump_threads, with XCL_THREAD_DUMP_AT: an access violation in RtlVirtualUnwind2 reading 0xf8).

dump_threads resumed each thread right after GetThreadContext, then unwound its stack from live memory. By that time the thread has either gone on, so the saved registers and return addresses are overwritten, or ended, so its stack is freed. A stale frame register sends RtlVirtualUnwind to a near-null address: the report's read. The fault is inside RtlVirtualUnwind, so no check after the call can catch it. Now, while the thread is stopped, the dump also copies its stack, and the unwinding reads the copy.

Seen in a run: a long run of a retail title on a local diagnostic build (main's dump_threads with other local changes; this PR was not in it) crashed in ntdll's unwinder (ntdll+0x20047, a read at 0xfb0, between RtlVirtualUnwind2 and RtlVirtualUnwind) 75 ms into a thread dump the stalled-heartbeat check took, on the thread taking it. Its registers point into an Opus-decoding thread (MSOpusDecoder.dll), which dump_threads had already resumed when it unwound its stack. Two earlier long runs of builds with the same dump_threads took 11 dumps each without a crash.

What is in it

  • copy_stack: from RSP to the end of its committed region, at most 256 KB. It uses system calls only (VirtualQuery, ReadProcessMemory) into a buffer allocated before any thread is stopped, so it takes no lock the stopped thread may hold. If the copy fails, for example because the thread is exiting, that thread is left out, as when GetThreadContext fails.

  • unwind reads the copy:

    • context registers that point into the copied range are moved into it, before each step and after it;
    • it stops where RSP, or the function's frame register (from UNWIND_INFO), would leave the copy;
    • the leaf case reads from the copy.

    unwind has no other caller.

  • Test eh::tests::thread_dumps_while_threads_run_and_exit: 40 dumps, with 4 threads busy in a recursion whose frames keep changing and 4 threads starting and joining short-lived threads.

  • Overlaps:

    • #164 calls dump_threads() on an unhandled exception, so it gets this fix.
    • #197 and #234 change eh.rs and merge with this without conflicts.
    • #164 and #194 already conflict with main; this adds no conflict to either.

Tested

  • RTX 5070 Ti, NVIDIA 610.74, Windows 11 Pro 26200; MSVC stable, debug.
  • cargo test --workspace -- --test-threads=4 on f67e35a (this PR, rebased onto main 930e8b4 without conflicts; the same patch as 4d05d43): 752 passed, 0 failed, 41 ignored (the xcl library: 708 passed, 21 ignored), eh::tests::thread_dumps_while_threads_run_and_exit among them. SKIPPED GPU tests: 2, both no wave64 (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware).
  • The earlier head 4d05d43, on main dd2ae9a: 691 passed, 0 failed, 41 ignored, the same two SKIPPED.
  • cargo test -p xcl --lib -- --exact eh::tests::thread_dumps_while_threads_run_and_exit on 4d05d43, 3 runs: 3 of 3 passed (4.1–4.3 s).
  • The new test, --exact, CPU only (no device), under a debugger that passes first-chance exceptions on and catches the second-chance one with its thread and stack. 20 runs each, interleaved:
    • main 60565c4 with the test added: 15 of 20 crashed, all from eh::unwind ← dump_threads. 4 were at ntdll+0x1ff2a in RtlVirtualUnwind2, reading a near-null address: the instruction in the report. 11 were at ntdll+0x1ff9f, reading other threads' stacks.
    • this change (built on 60565c4; the same code as 12328ac): 20 of 20 passed.
  • The dumps still show whole stacks, down to RtlUserThreadStart.
  • Independent run by @⁠jleybourne (https://github.com/ivall/xcl/pull/253#issuecomment-7119139250): RTX 4070 Ti (NVIDIA 610.88), i7-10700KF, Windows 11 26300, Rust 1.100.0, debug, 12328ac. scripts/test.ps1: 652 passed, 0 failed, 40 ignored; SKIPPED only the 2 no wave64 tests; the e2e test title test passed.
  • The report's case, a retail title with XCL_THREAD_DUMP_AT, run by @⁠Natakout (https://github.com/ivall/xcl/pull/253#issuecomment-7135997990): RTX 3060 12 GB (NVIDIA 621.14), Windows 11 25H2, release, 4d05d43 (the same patch as this head) and main 47efa2e, dumps at 140, 170, 200, 230, 250 and 260 s. On main the run dies at 200.13 s on the dumping thread, during the third dump (0xc0000005 in ntdll.dll+0x79a67, a read at 0x376). With this PR all six dumps are written (168–170 threads each).
  • The same case run by @⁠Anon64 (https://github.com/ivall/xcl/pull/253#issuecomment-7136004076): RTX 3060 12 GB (NVIDIA 581.80), Windows 11 26200, release, this head f67e35a and main 930e8b4, a dump every 5 s from 70 s. On main the second dump (75.17 s) faults on the dumping thread in ntdll.dll+0x20191 (a read at 0xffffffffffffffff) and the process hangs. With this PR all 9 dumps are written (70–105 s, 173–176 threads each). Their smoke pair of the same two commits: 1571 / 1585 frames (99 %), peak commit 22979 / 20665 MB (111 %), no crash or device removal.

Regression run

Our own runs, one after the other on the machine under Tested (RTX 5070 Ti), release builds, no uncommitted changes: main at 930e8b4 (this PR's base), then this PR's head. 98 % of main's frames, 99 % of its peak commit.

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1317 (PresentX 1318)
presents per 2 s (last 3): 39 51 10
device removals: 0
crashes: 0
peak commit: 28215 MB

PR:

xcl-smoke v1
commit: f67e35aeb09291534ff47a627e42c1f6a91c67b3
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1296 (PresentX 1296)
presents per 2 s (last 3): 43 46 7
device removals: 0
crashes: 0
peak commit: 27964 MB

Not tested

  • AMD GPUs; a dump taken at the moment of a crash.
  • Wine.
  • Function tables registered with RtlInstallFunctionTableCallback.
  • One case is still open: a stack deeper than the 256 KB copy, with a frame of more than 64 KB at the copy's end. RtlVirtualUnwind reads that frame's return address before the bound check, so it could read past the buffer and its 64 KB slack.
  • macOS / Linux: not built.

AI use

  • Claude Code, Claude Opus 5.5: reproduced the crash with a test, wrote the change, the test and this description; the runs above are its own.

🤖 Generated with Claude Code

**@⁠Kalmarv** on GitHub · 2026-11-23 21:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/253) `Kalmarv:fix/thread-dump-stack-copy` → `main` · +95 −11 · 1 files · 1 commits · open Refs #106 ([the crash in `eh::dump_threads`](https://github.com/ivall/xcl/issues/106#issuecomment-7114683441), with `XCL_THREAD_DUMP_AT`: an access violation in `RtlVirtualUnwind2` reading `0xf8`). `dump_threads` resumed each thread right after `GetThreadContext`, then unwound its stack from live memory. By that time the thread has either gone on, so the saved registers and return addresses are overwritten, or ended, so its stack is freed. A stale frame register sends `RtlVirtualUnwind` to a near-null address: the report's read. The fault is inside `RtlVirtualUnwind`, so no check after the call can catch it. Now, while the thread is stopped, the dump also copies its stack, and the unwinding reads the copy. Seen in a run: a long run of a retail title on a local diagnostic build (`main`'s `dump_threads` with other local changes; this PR was not in it) crashed in ntdll's unwinder (`ntdll+0x20047`, a read at `0xfb0`, between `RtlVirtualUnwind2` and `RtlVirtualUnwind`) 75 ms into a thread dump the stalled-heartbeat check took, on the thread taking it. Its registers point into an Opus-decoding thread (`MSOpusDecoder.dll`), which `dump_threads` had already resumed when it unwound its stack. Two earlier long runs of builds with the same `dump_threads` took 11 dumps each without a crash. **What is in it** - `copy_stack`: from RSP to the end of its committed region, at most 256 KB. It uses system calls only (`VirtualQuery`, `ReadProcessMemory`) into a buffer allocated before any thread is stopped, so it takes no lock the stopped thread may hold. If the copy fails, for example because the thread is exiting, that thread is left out, as when `GetThreadContext` fails. - `unwind` reads the copy: - context registers that point into the copied range are moved into it, before each step and after it; - it stops where RSP, or the function's frame register (from `UNWIND_INFO`), would leave the copy; - the leaf case reads from the copy. `unwind` has no other caller. - Test `eh::tests::thread_dumps_while_threads_run_and_exit`: 40 dumps, with 4 threads busy in a recursion whose frames keep changing and 4 threads starting and joining short-lived threads. - Overlaps: - #164 calls `dump_threads()` on an unhandled exception, so it gets this fix. - #197 and #234 change `eh.rs` and merge with this without conflicts. - #164 and #194 already conflict with main; this adds no conflict to either. **Tested** - RTX 5070 Ti, NVIDIA 610.74, Windows 11 Pro 26200; MSVC stable, debug. - `cargo test --workspace -- --test-threads=4` on `f67e35a` (this PR, rebased onto main `930e8b4` without conflicts; the same patch as `4d05d43`): 752 passed, 0 failed, 41 ignored (the `xcl` library: 708 passed, 21 ignored), `eh::tests::thread_dumps_while_threads_run_and_exit` among them. SKIPPED GPU tests: 2, both `no wave64` (`gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`). - The earlier head `4d05d43`, on main `dd2ae9a`: 691 passed, 0 failed, 41 ignored, the same two SKIPPED. - `cargo test -p xcl --lib -- --exact eh::tests::thread_dumps_while_threads_run_and_exit` on `4d05d43`, 3 runs: 3 of 3 passed (4.1–4.3 s). - The new test, `--exact`, CPU only (no device), under a debugger that passes first-chance exceptions on and catches the second-chance one with its thread and stack. 20 runs each, interleaved: - main `60565c4` with the test added: 15 of 20 crashed, all from `eh::unwind` ← `dump_threads`. 4 were at `ntdll+0x1ff2a` in `RtlVirtualUnwind2`, reading a near-null address: the instruction in the report. 11 were at `ntdll+0x1ff9f`, reading other threads' stacks. - this change (built on `60565c4`; the same code as `12328ac`): 20 of 20 passed. - The dumps still show whole stacks, down to `RtlUserThreadStart`. - Independent run by @⁠jleybourne (https://github.com/ivall/xcl/pull/253#issuecomment-7119139250): RTX 4070 Ti (NVIDIA 610.88), i7-10700KF, Windows 11 26300, Rust 1.100.0, debug, `12328ac`. `scripts/test.ps1`: 652 passed, 0 failed, 40 ignored; SKIPPED only the 2 `no wave64` tests; the e2e test title test passed. - The report's case, a retail title with `XCL_THREAD_DUMP_AT`, run by @⁠Natakout (https://github.com/ivall/xcl/pull/253#issuecomment-7135997990): RTX 3060 12 GB (NVIDIA 621.14), Windows 11 25H2, release, `4d05d43` (the same patch as this head) and main `47efa2e`, dumps at 140, 170, 200, 230, 250 and 260 s. On main the run dies at 200.13 s on the dumping thread, during the third dump (`0xc0000005` in `ntdll.dll+0x79a67`, a read at `0x376`). With this PR all six dumps are written (168–170 threads each). - The same case run by @⁠Anon64 (https://github.com/ivall/xcl/pull/253#issuecomment-7136004076): RTX 3060 12 GB (NVIDIA 581.80), Windows 11 26200, release, this head `f67e35a` and main `930e8b4`, a dump every 5 s from 70 s. On main the second dump (75.17 s) faults on the dumping thread in `ntdll.dll+0x20191` (a read at `0xffffffffffffffff`) and the process hangs. With this PR all 9 dumps are written (70–105 s, 173–176 threads each). Their smoke pair of the same two commits: 1571 / 1585 frames (99 %), peak commit 22979 / 20665 MB (111 %), no crash or device removal. **Regression run** Our own runs, one after the other on the machine under **Tested** (RTX 5070 Ti), release builds, no uncommitted changes: `main` at `930e8b4` (this PR's base), then this PR's head. 98 % of `main`'s frames, 99 % of its peak commit. main: ``` xcl-smoke v1 commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1317 (PresentX 1318) presents per 2 s (last 3): 39 51 10 device removals: 0 crashes: 0 peak commit: 28215 MB ``` PR: ``` xcl-smoke v1 commit: f67e35aeb09291534ff47a627e42c1f6a91c67b3 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1296 (PresentX 1296) presents per 2 s (last 3): 43 46 7 device removals: 0 crashes: 0 peak commit: 27964 MB ``` **Not tested** - AMD GPUs; a dump taken at the moment of a crash. - Wine. - Function tables registered with `RtlInstallFunctionTableCallback`. - One case is still open: a stack deeper than the 256 KB copy, with a frame of more than 64 KB at the copy's end. `RtlVirtualUnwind` reads that frame's return address before the bound check, so it could read past the buffer and its 64 KB slack. - macOS / Linux: not built. **AI use** - Claude Code, Claude Opus 5.5: reproduced the crash with a test, wrote the change, the test and this description; the runs above are its own. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
dump_threads resumed each thread right after GetThreadContext and only
then unwound its stack, from the live memory: by then the thread had
gone on (its saved registers and return addresses overwritten) or ended
(its stack freed). RtlVirtualUnwind followed a stale frame register to
a near-null address, or read a freed stack: an access violation in the
dump thread (#106).

While the thread is stopped, the dump now also copies its stack (from
RSP, up to 256 KB, with system calls only); the unwinding reads the
copy, with addresses into the stack moved to it, and stops where a frame
would leave it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:17:38 +00:00
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-23 22:39 UTC · original

Regression run wanted. We have no title on our machine. If you can run scripts/smoke.ps1 -Game <your title folder> twice, once built from main (9ab7d76) and once from this PR's head (12328ac), please paste both xcl-smoke blocks here. I'll copy them into the description under Regression run, with your name and hardware.

🤖 Claude Opus 5.5

**@⁠Kalmarv** on GitHub · 2026-11-23 22:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/253#issuecomment-7116021716) **Regression run wanted.** We have no title on our machine. If you can run `scripts/smoke.ps1 -Game <your title folder>` twice, once built from `main` (`9ab7d76`) and once from this PR's head (`12328ac`), please paste both `xcl-smoke` blocks here. I'll copy them into the description under **Regression run**, with your name and hardware. 🤖 Claude Opus 5.5
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 04:33 UTC · original

Test run of 4d05d437d8c9d47a3f0f39fd9a17fada072f4536 on AMD RDNA4. I merged it onto current main 64b3f35 locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 702 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 661 passed, 0 failed, 21 ignored
  • 0 SKIPPED; the eh tests pass (no thread dump was triggered here).

Review: Copying each stopped thread's stack (from rsp to the end of its committed region, at most 256 KiB) before resuming it removes the read of a live stack that crashed in #106. A question I could not settle from the diff: frames that use RBP as a frame pointer, and any pointer the unwinder follows from the context, still hold addresses of the original stack, so RtlVirtualUnwind may read the live stack there rather than the copy. If the unwind only ever reads relative to the copied RSP that is fine; otherwise the context registers that point into the stack would need the same rebase.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

**@⁠MesshM** on GitHub · 2026-11-24 04:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/253#issuecomment-7122133355) Test run of `4d05d437d8c9d47a3f0f39fd9a17fada072f4536` on AMD RDNA4. I merged it onto current `main` `64b3f35` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **702 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 661 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; the `eh` tests pass (no thread dump was triggered here). **Review:** Copying each stopped thread's stack (from `rsp` to the end of its committed region, at most 256 KiB) before resuming it removes the read of a live stack that crashed in #106. A question I could not settle from the diff: frames that use RBP as a frame pointer, and any pointer the unwinder follows from the context, still hold addresses of the original stack, so `RtlVirtualUnwind` may read the live stack there rather than the copy. If the unwind only ever reads relative to the copied RSP that is fine; otherwise the context registers that point into the stack would need the same rebase. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 04:35 UTC · original

@⁠MesshM Thanks for the RDNA4 run. On the question: the unwind already moves those registers to the copy (eh.rs, unwind, 4d05d43):

  • Before the first frame, each of the 16 general registers in the context whose value falls in the copied range of the original stack (from the stopped thread's RSP up the copy's length) is moved by the same offset into the copy. RSP and RBP are among them.
  • After each RtlVirtualUnwind, the same is done again. A frame register or a saved RBP that the unwinder restored from the copy still holds an address of the original stack, and it's moved into the copy before the next frame.
  • Before unwinding a frame with a frame register (UNWIND_INFO byte 3, low nibble), the dump checks that this register points into the copy. If it doesn't, for example when the frame lies beyond the 256 KiB copied, the dump stops there and doesn't read the live stack. It also stops when RSP leaves the copy.

So the unwinder reads only the copy, plus a 64 KiB margin after it in the same buffer, never the stopped thread's live stack. What it doesn't fix up is a pointer to the stack that sits in memory outside the stack: an unwind of x64 code doesn't follow one.

🤖 Claude Opus 5.5

**@⁠Kalmarv** on GitHub · 2026-11-24 04:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/253#issuecomment-7122154399) @⁠MesshM Thanks for the RDNA4 run. On the question: the unwind already moves those registers to the copy (`eh.rs`, `unwind`, 4d05d43): - Before the first frame, each of the 16 general registers in the context whose value falls in the copied range of the original stack (from the stopped thread's RSP up the copy's length) is moved by the same offset into the copy. RSP and RBP are among them. - After each `RtlVirtualUnwind`, the same is done again. A frame register or a saved RBP that the unwinder restored from the copy still holds an address of the original stack, and it's moved into the copy before the next frame. - Before unwinding a frame with a frame register (UNWIND_INFO byte 3, low nibble), the dump checks that this register points into the copy. If it doesn't, for example when the frame lies beyond the 256 KiB copied, the dump stops there and doesn't read the live stack. It also stops when RSP leaves the copy. So the unwinder reads only the copy, plus a 64 KiB margin after it in the same buffer, never the stopped thread's live stack. What it doesn't fix up is a pointer to the stack that sits in memory outside the stack: an unwind of x64 code doesn't follow one. 🤖 Claude Opus 5.5
Author
Owner

@⁠Natakout on GitHub · 2026-11-24 15:25 UTC · original

Test report: thread dumps no longer crash the run (RTX 3060)

Commit tested: this PR's head 4d05d43, against main 47efa2e.

Tested

  • RTX 3060 12 GB, NVIDIA driver 621.14, Windows 11 25H2, rustc 1.94.1, release build. A retail title run in the interactive session, with XCL_PRESS_AT to get past the menus into the world load and XCL_THREAD_DUMP_AT=140,170,200,230,250,260.
  • On main: the dumps at 140 s and 170 s are written. The run then dies at 200.13 s inside the dumping thread itself, during the third dump: unhandled exception 0xc0000005 in ntdll.dll+0x79a67 (read at address 0x376). This is the RtlVirtualUnwind crash from #106.
  • With this PR: all six dumps are written (168-170 threads each), including the ones at 250 s and 260 s while the title's presents are already at 0. The run then ends in the title's own known #505 null write at 279.8 s, which this PR does not touch.

Not tested

  • AMD GPUs.
  • Dumps taken at the very moment of a crash.
  • The PR is based on f4ce27c, so the title's shaders were recompiled for this run. Shader cache state therefore differs from the main run; it does not affect the dump path.

AI use
Claude (claude-opus-5-5, through Hermes) ran the builds and the title runs on the hardware above over SSH, read the logs and drafted this report.

**@⁠Natakout** on GitHub · 2026-11-24 15:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/253#issuecomment-7135997990) **Test report: thread dumps no longer crash the run (RTX 3060)** Commit tested: this PR's head 4d05d43, against `main` 47efa2e. **Tested** - RTX 3060 12 GB, NVIDIA driver 621.14, Windows 11 25H2, rustc 1.94.1, release build. A retail title run in the interactive session, with `XCL_PRESS_AT` to get past the menus into the world load and `XCL_THREAD_DUMP_AT=140,170,200,230,250,260`. - On `main`: the dumps at 140 s and 170 s are written. The run then dies at 200.13 s inside the dumping thread itself, during the third dump: `unhandled exception 0xc0000005 in ntdll.dll+0x79a67 (read at address 0x376)`. This is the `RtlVirtualUnwind` crash from #106. - With this PR: all six dumps are written (168-170 threads each), including the ones at 250 s and 260 s while the title's presents are already at 0. The run then ends in the title's own known #505 null write at 279.8 s, which this PR does not touch. **Not tested** - AMD GPUs. - Dumps taken at the very moment of a crash. - The PR is based on f4ce27c, so the title's shaders were recompiled for this run. Shader cache state therefore differs from the `main` run; it does not affect the dump path. **AI use** Claude (claude-opus-5-5, through Hermes) ran the builds and the title runs on the hardware above over SSH, read the logs and drafted this report.
Author
Owner

@⁠Anon64 on GitHub · 2026-11-24 15:25 UTC · original

Regression run, as asked: this PR's head f67e35a and main 930e8b4 (its merge base). RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s, scripts/smoke.ps1 on a retail title for 60 s.

main 930e8b4:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1585 (PresentX 1585)
presents per 2 s (last 3): 60 46 45
device removals: 0
crashes: 0
peak commit: 20665 MB

this PR:

xcl-smoke v1
commit: f67e35aeb09291534ff47a627e42c1f6a91c67b3
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1571 (PresentX 1571)
presents per 2 s (last 3): 43 52 22
device removals: 0
crashes: 0
peak commit: 22979 MB

No device removals or crashes; 99 % of main's frames, 111 % of its peak commit.

The crash this PR fixes, reproduced on main 930e8b4: a 150 s world-loading run with XCL_THREAD_DUMP_AT every 5 s from 70 s took the first dump (143 threads) and then, at the second (75.17 s), faulted on the dumping thread in ntdll.dll+0x20191, a read at 0xffffffffffffffff. The process did not end; it hung until I stopped it.

The same run on this PR's head: all 9 dumps were written (70 s to 105 s, 173–176 threads each), no fault in the unwinder. The run ended at 105 s in the title's own hang watchdog during world loading, which main hits on this card without dumps too (104–116 s in earlier runs).

Not tested: the whole suite; AMD.

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

**@⁠Anon64** on GitHub · 2026-11-24 15:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/253#issuecomment-7136004076) Regression run, as asked: this PR's head `f67e35a` and `main` `930e8b4` (its merge base). RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s, `scripts/smoke.ps1` on a retail title for 60 s. main `930e8b4`: ``` xcl-smoke v1 commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1585 (PresentX 1585) presents per 2 s (last 3): 60 46 45 device removals: 0 crashes: 0 peak commit: 20665 MB ``` this PR: ``` xcl-smoke v1 commit: f67e35aeb09291534ff47a627e42c1f6a91c67b3 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1571 (PresentX 1571) presents per 2 s (last 3): 43 52 22 device removals: 0 crashes: 0 peak commit: 22979 MB ``` No device removals or crashes; 99 % of main's frames, 111 % of its peak commit. **The crash this PR fixes, reproduced on `main` `930e8b4`:** a 150 s world-loading run with `XCL_THREAD_DUMP_AT` every 5 s from 70 s took the first dump (143 threads) and then, at the second (75.17 s), faulted on the dumping thread in `ntdll.dll+0x20191`, a read at `0xffffffffffffffff`. The process did not end; it hung until I stopped it. **The same run on this PR's head:** all 9 dumps were written (70 s to 105 s, 173–176 threads each), no fault in the unwinder. The run ended at 105 s in the title's own hang watchdog during world loading, which `main` hits on this card without dumps too (104–116 s in earlier runs). **Not tested:** the whole suite; AMD. Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 17:13 UTC · original

@⁠Natakout, @⁠Anon64 thank you. These are the first runs of the case from the report: a title with XCL_THREAD_DUMP_AT, crashing on main inside the unwinder and writing every dump with this PR. Both runs are now in the description under Tested, Anon64's smoke pair included, and "a title with XCL_THREAD_DUMP_AT" is no longer under Not tested.

AI use: Claude Code (Claude Opus 5.5)

**@⁠Kalmarv** on GitHub · 2026-11-24 17:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/253#issuecomment-7138878617) @⁠Natakout, @⁠Anon64 thank you. These are the first runs of the case from the report: a title with `XCL_THREAD_DUMP_AT`, crashing on `main` inside the unwinder and writing every dump with this PR. Both runs are now in the description under **Tested**, Anon64's smoke pair included, and "a title with `XCL_THREAD_DUMP_AT`" is no longer under **Not tested**. **AI use:** Claude Code (Claude Opus 5.5)
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 15:14 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 15:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/253#issuecomment-7166520612) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-26 01:21 UTC · original

Independent Windows check of #253 head f67e35a merged locally, without a commit or conflict, onto current main b49be18. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / driver 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11. The test checkout had only the staged merge changes.

Tested

  • cargo test --offline --locked -p xcl --lib eh::tests::thread_dumps_while_threads_run_and_exit -- --exact --nocapture --test-threads=1: five consecutive processes passed, 1/0/0 each, no skips. The checked-in test exercises concurrent thread activity and exits while taking dumps.
  • cargo build --offline --locked --workspace: passed.
  • cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4: 1,436 passed, 0 failed, 47 ignored, with 25 SKIPPED notices. The thread-dump test passed within this run too. The Invalid bitcode signature line belongs to the passing malformed-container test.

Not tested

  • A retail title, dump-on-crash timing, Wine, or the deep-stack/large-frame edge case already described in the PR. The result is for the uncommitted integration with current main, not a new PR commit.

AI use

  • Codex (GPT-6.2 Sol) ran the checks, verified the logs and drafted this report. AI-assisted.
**@⁠thehollowedone** on GitHub · 2026-11-26 01:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/253#issuecomment-7179692736) Independent Windows check of [#253 head `f67e35a`](https://github.com/xcl-dev/xcl/commit/f67e35aeb09291534ff47a627e42c1f6a91c67b3) merged locally, without a commit or conflict, onto [current main `b49be18`](https://github.com/xcl-dev/xcl/commit/b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7). Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / driver 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11. The test checkout had only the staged merge changes. **Tested** - `cargo test --offline --locked -p xcl --lib eh::tests::thread_dumps_while_threads_run_and_exit -- --exact --nocapture --test-threads=1`: five consecutive processes passed, 1/0/0 each, no skips. The checked-in test exercises concurrent thread activity and exits while taking dumps. - `cargo build --offline --locked --workspace`: passed. - `cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4`: **1,436 passed, 0 failed, 47 ignored**, with **25 `SKIPPED` notices**. The thread-dump test passed within this run too. The `Invalid bitcode signature` line belongs to the passing malformed-container test. **Not tested** - A retail title, dump-on-crash timing, Wine, or the deep-stack/large-frame edge case already described in the PR. The result is for the uncommitted integration with current main, not a new PR commit. **AI use** - Codex (GPT-6.2 Sol) ran the checks, verified the logs and drafted this report. AI-assisted.
Author
Owner

@⁠pickles976 on GitHub · 2026-11-26 07:24 UTC · original

Tested — Wine CPU-only follow-through

Exact production head f67e35aeb09291534ff47a627e42c1f6a91c67b3, no source changes. Linux6.17 / Wine11.0, Rust1.98.1 MSVC target. Fresh Compiling xcl line names the selected xcl-pr253 checkout; touched src/lib.rs and build.rs before this shared-target worktree switch (including regenerated IDs).

cargo +1.98.1 test --locked --target x86_64-pc-windows-msvc -p xcl --lib eh::tests::thread_dumps_while_threads_run_and_exit -- --exact --nocapture --test-threads=1

1 passed, 0 failed, 0 ignored, 0.46s; fresh build15.81s. Log contains 40 actual dumps, 9–9 threads each, with multi-frame traces including kernel32/ntdll frames. No exception or timeout. Scope MemoryMax9GiB / MemorySwapMax512MiB, 180s timeout. Evidence .compat-xcl/logs/verify-pr253-wine-thread-dumps.log.

This fills a focused Wine-test gap, not the title regression requirement. Our earlier title dump had a near-null ntdll+0x38a26 AV; matching PE/PDB and bounded disassembly put its captured return at xcl::eh::dump_threads+0x21d, immediately after the kernel32!RtlVirtualUnwind import call: scoped evidence in #106. I did not rerun that unchanged crashing title probe.

Not tested

Retail title with this PR, dump-at-crash timing, callback function tables, or the already-described deep-stack/large-frame read beyond the copy/slack. That known boundary gap remains; this pass is not a blanket unwind-safety claim. No GPU workload in this fixture, no frame-time/gameplay claim. The shared Wine prefix contains the lab's diagnostic-relaxed vkd3d build, but this test does not create a GPU device.

AI use: omp, harness model openai-codex/gpt-6-astra, ran the check and drafted this report. No upstream code changes.

**@⁠pickles976** on GitHub · 2026-11-26 07:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/253#issuecomment-7185414216) ## Tested — Wine CPU-only follow-through Exact production head `f67e35aeb09291534ff47a627e42c1f6a91c67b3`, no source changes. Linux6.17 / Wine11.0, Rust1.98.1 MSVC target. Fresh `Compiling xcl` line names the selected `xcl-pr253` checkout; touched `src/lib.rs` and `build.rs` before this shared-target worktree switch (including regenerated IDs). ``` cargo +1.98.1 test --locked --target x86_64-pc-windows-msvc -p xcl --lib eh::tests::thread_dumps_while_threads_run_and_exit -- --exact --nocapture --test-threads=1 ``` **1 passed, 0 failed, 0 ignored**, 0.46s; fresh build15.81s. Log contains **40 actual dumps**, 9–9 threads each, with multi-frame traces including kernel32/ntdll frames. No exception or timeout. Scope MemoryMax9GiB / MemorySwapMax512MiB, 180s timeout. Evidence `.compat-xcl/logs/verify-pr253-wine-thread-dumps.log`. This fills a focused Wine-test gap, not the title regression requirement. Our earlier title dump had a near-null `ntdll+0x38a26` AV; matching PE/PDB and bounded disassembly put its captured return at `xcl::eh::dump_threads+0x21d`, immediately after the `kernel32!RtlVirtualUnwind` import call: [scoped evidence in #106](https://git.gtahub.st/github/xcl-dev--xcl/issues/106). I did not rerun that unchanged crashing title probe. ## Not tested Retail title with this PR, dump-at-crash timing, callback function tables, or the already-described deep-stack/large-frame read beyond the copy/slack. That known boundary gap remains; this pass is **not a blanket unwind-safety claim**. No GPU workload in this fixture, no frame-time/gameplay claim. The shared Wine prefix contains the lab's diagnostic-relaxed vkd3d build, but this test does not create a GPU device. AI use: omp, harness model `openai-codex/gpt-6-astra`, ran the check and drafted this report. No upstream code changes.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-26 07:31 UTC · original

Thanks @⁠pickles976 for running this under Wine on f67e35a (CPU only): thread_dumps_while_threads_run_and_exit passed 1 of 1, with 40 dumps of 9 threads each and no exception or timeout. It covers the Wine side of the fix. As you note, it does not cover the title probe or the deep-stack read past the copy, and both are still open.

AI use: Claude Code (Claude Opus 5.5) drafted this comment from the linked report.

**@⁠Kalmarv** on GitHub · 2026-11-26 07:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/253#issuecomment-7185548746) Thanks @⁠pickles976 for running this under Wine on `f67e35a` (CPU only): `thread_dumps_while_threads_run_and_exit` passed 1 of 1, with 40 dumps of 9 threads each and no exception or timeout. It covers the Wine side of the fix. As you note, it does not cover the title probe or the deep-stack read past the copy, and both are still open. AI use: Claude Code (Claude Opus 5.5) drafted this comment from the linked report.
Author
Owner

@⁠iggyvilla on GitHub · 2026-11-26 09:00 UTC · original

Test report on AMD RDNA2 (RX 6650 XT), including crash/removal-time thread dumps (two items under Not tested).

Commit tested: f67e35aeb09291534ff47a627e42c1f6a91c67b3 (applied cleanly without code changes onto main b49be183 for the unit/workspace suite, and cherry-picked cleanly onto a local test stack 08db802 + #2615 + #2598 + #751 + #2404 for the retail runs).

Tested

  • Hardware: AMD Radeon RX 6650 XT 8 GB (RDNA2, driver 32.0.21045.29003), Ryzen 7 5700X, 32 GB RAM, Windows 11, stable-x86_64-pc-windows-msvc.
  • cargo test -p xcl --lib eh:: (debug, on main b49be183 + f67e35ae): 7 passed, 0 failed, 0 ignored (note: thread_dumps_while_threads_run_and_exit also passed 5/5 on unfixed b49be183 here).
  • cargo test --workspace --no-fail-fast -- --test-threads=4 (debug, same tree): xcl lib 1309 passed, 1 failed, 27 ignored; e2e 3 passed, 1 failed; 0 failures elsewhere. Both failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 seed 783 and e2e::test_title_runs_and_game_folder_is_untouched at crates/xcl/tests/e2e.rs:249) reproduce identically on unmodified main b49be183 (checked by stashing). 7 SKIPPED GPU tests (6 f16/f32 programs refused per #1426; pso_measurement_compiles_an_exact_synthetic_record cannot disable driver cache without Developer Mode).
  • Retail title with XCL_THREAD_DUMP_AT=150 + crash/removal-time dumps (release, interactive session, XCL_NETWORK=0, XCL_DIRECT_DXIL=1 precompiled cache, on the test stack above):
    • With f67e35ae (2 runs):
      • 150 s scheduled dump completed cleanly in both runs: 111 threads (run 1) and 112 threads (run 2), header counts matching logged thread lines.
      • Crash/removal-time dump after the known 0x887a0006 device removal completed cleanly in both runs at high thread count: 229 threads at 178.0 s (run 1) and 261 threads at 184.7 s (run 2, after the title's post-removal breakpoint).
      • 0/2 ntdll+0x1ff2a access violations in the dump thread; 0 WER dumps.
    • Without f67e35ae (2 control runs on the same stack):
      • 2/2 runs hit 0xc0000005 at ntdll+0x1ff2a during the post-removal thread dump (run 1: read at 0xfffffffffffffffe, 0.18 s after removal; run 2: read at 0x7, ~20 s after removal), producing 2 WER dumps (same crash as #2689, also seen in 2/4 earlier runs without this PR).

Not tested

  • scripts/smoke.ps1 pair on standalone main + f67e35ae (the retail runs above were on the local test stack noted above, not standalone main).
  • The >256 KB stack / >64 KB frame edge case already noted in the PR description, or RtlInstallFunctionTableCallback.
  • NVIDIA, Intel, Wine.

AI use

  • Claude Code, Claude Sonnet 5.5: applied f67e35ae, ran the unit/workspace suite and retail runs, and recorded the counts/logs.
  • omp, Muse Spark 1.3: reviewed the diff and unwind-copy soundness.
  • Antigravity, Gemini 4 Neon (High): verified the counts against the run logs and drafted this comment.
**@⁠iggyvilla** on GitHub · 2026-11-26 09:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/253#issuecomment-7187300116) Test report on AMD RDNA2 (RX 6650 XT), including crash/removal-time thread dumps (two items under **Not tested**). **Commit tested:** `f67e35aeb09291534ff47a627e42c1f6a91c67b3` (applied cleanly without code changes onto `main` `b49be183` for the unit/workspace suite, and cherry-picked cleanly onto a local test stack `08db802` + `#2615` + `#2598` + `#751` + `#2404` for the retail runs). **Tested** - Hardware: AMD Radeon RX 6650 XT 8 GB (RDNA2, driver `32.0.21045.29003`), Ryzen 7 5700X, 32 GB RAM, Windows 11, `stable-x86_64-pc-windows-msvc`. - `cargo test -p xcl --lib eh::` (debug, on `main` `b49be183` + `f67e35ae`): **7 passed, 0 failed, 0 ignored** (note: `thread_dumps_while_threads_run_and_exit` also passed 5/5 on unfixed `b49be183` here). - `cargo test --workspace --no-fail-fast -- --test-threads=4` (debug, same tree): `xcl` lib **1309 passed, 1 failed, 27 ignored**; `e2e` **3 passed, 1 failed**; 0 failures elsewhere. Both failures (`gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` seed 783 and `e2e::test_title_runs_and_game_folder_is_untouched` at `crates/xcl/tests/e2e.rs:249`) reproduce identically on unmodified `main` `b49be183` (checked by stashing). 7 `SKIPPED` GPU tests (6 f16/f32 programs refused per `#1426`; `pso_measurement_compiles_an_exact_synthetic_record` cannot disable driver cache without Developer Mode). - Retail title with `XCL_THREAD_DUMP_AT=150` + crash/removal-time dumps (release, interactive session, `XCL_NETWORK=0`, `XCL_DIRECT_DXIL=1` precompiled cache, on the test stack above): - **With `f67e35ae` (2 runs):** - 150 s scheduled dump completed cleanly in both runs: 111 threads (run 1) and 112 threads (run 2), header counts matching logged thread lines. - Crash/removal-time dump after the known `0x887a0006` device removal completed cleanly in both runs at high thread count: **229 threads** at 178.0 s (run 1) and **261 threads** at 184.7 s (run 2, after the title's post-removal breakpoint). - **0/2** `ntdll+0x1ff2a` access violations in the dump thread; 0 WER dumps. - **Without `f67e35ae` (2 control runs on the same stack):** - **2/2** runs hit `0xc0000005` at `ntdll+0x1ff2a` during the post-removal thread dump (run 1: read at `0xfffffffffffffffe`, 0.18 s after removal; run 2: read at `0x7`, ~20 s after removal), producing 2 WER dumps (same crash as `#2689`, also seen in 2/4 earlier runs without this PR). **Not tested** - `scripts/smoke.ps1` pair on standalone `main` + `f67e35ae` (the retail runs above were on the local test stack noted above, not standalone `main`). - The >256 KB stack / >64 KB frame edge case already noted in the PR description, or `RtlInstallFunctionTableCallback`. - NVIDIA, Intel, Wine. **AI use** - Claude Code, Claude Sonnet 5.5: applied `f67e35ae`, ran the unit/workspace suite and retail runs, and recorded the counts/logs. - omp, Muse Spark 1.3: reviewed the diff and unwind-copy soundness. - Antigravity, Gemini 4 Neon (High): verified the counts against the run logs and drafted this comment.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/253/head:github-bot/gh-253'
git switch 'github-bot/gh-253'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-253'
git switch 'github-bot/gh-253'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-253'
git switch 'github-bot/gh-253'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-253'
git switch 'main'
git merge --squash 'github-bot/gh-253'
git switch 'main'
git merge --ff-only 'github-bot/gh-253'
git switch 'main'
git merge 'github-bot/gh-253'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.