xcl run: end the process when the title's crash filter has not ended it in 30 s #967

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

@⁠milas6669 on GitHub · 2026-11-24 09:38 UTC · original
milas6669:crash-deadline → main · +165 −0 · 3 files · 1 commits · open

After an unhandled exception XCL logs the crash and hands over to the title's own crash filter. A retail title's filter (a crash report of a process with tens of GB committed) can take very long or never return, and nothing in XCL ends the process then. On an 8 GB card the run ended with 0xc0000005 in VCRUNTIME140.dll, the process ends line never came, and the process stayed "not responding" with 29 GB committed for 4 minutes until it was killed by hand (the same happened in a second run).

A thread started with the crash handler waits for the first unhandled exception, then gives the process XCL_CRASH_EXIT_SECONDS (default 30; 0 turns it off) to end by itself, and ends it through the real NtTerminateProcess (not our hook, whose thread dump could hang the same way) with status 0xC0000005. A process that ends in time is left alone.

What is in it

  • crates/xcl/src/eh.rs: crash_exit_seconds, crash_deadline (takes the end action as a closure, so it can be tested), end_process_now, the thread started in install_crash_handler, and CRASHED set at the top of unhandled_filter; three unit tests of crash_deadline (ends a process that does not end itself; leaves one that ends in time; waits for a crash first)
  • tests/testtitle/src/main.rs: --hang-in-crash-filter (a crash filter that sleeps forever, then a null write)
  • crates/xcl/tests/e2e.rs: a_crash_filter_that_never_returns_does_not_keep_the_process_alive runs it with XCL_CRASH_EXIT_SECONDS=2, kills the process tree if it is still alive after 120 s, and checks the log for the crash and for the deadline line

Tested

  • NVIDIA GeForce RTX 3070 (32-lane waves), Intel i9-10900KF, Windows 11 Pro 10.0.26200, MSVC 19.44, rustc 1.100.0, debug build
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on this commit: 723 passed, 0 failed, 41 ignored
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64)
  • The new e2e test passes in 4.3 s. It fails without the change: with eh.rs from main, the process is still alive after 120 s and the test fails with "the process was still alive 120 s after the title's crash filter hung" (120.8 s)

Regression run (retail title, 60 s, release builds, default settings)

main (6bac4b4):

xcl-smoke v1
commit: 6bac4b4419886acc940d479dcf8815d0b1804435
gpu: NVIDIA GeForce RTX 3070
title: dumped
seconds: 60
exit: 0x0
frames shown: 1480 (PresentX 1480)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19520 MB

this PR (c997205):

xcl-smoke v1
commit: c997205f42d5edcf0ba4b5ec936a744364715286
gpu: NVIDIA GeForce RTX 3070
title: dumped
seconds: 60
exit: 0x0
frames shown: 1534 (PresentX 1534)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17960 MB

Not tested

  • the real title with a hanging crash filter: the hang happened twice in my runs of the retail title, but not every crash, so I did not wait for one with this build; the title's crash filter is only simulated by the test title
  • AMD, Wine, a deadline other than 2 s and 30 s
  • whether 30 s is long enough for the title's crash filter to finish a normal report; it can be raised or turned off with XCL_CRASH_EXIT_SECONDS

AI use

  • Claude Code, Claude Sonnet 5.5: found the hang in my runs, wrote the code, the tests and this description, and ran the test suite and the regression runs.
**@⁠milas6669** on GitHub · 2026-11-24 09:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/967) `milas6669:crash-deadline` → `main` · +165 −0 · 3 files · 1 commits · open After an unhandled exception XCL logs the crash and hands over to the title's own crash filter. A retail title's filter (a crash report of a process with tens of GB committed) can take very long or never return, and nothing in XCL ends the process then. On an 8 GB card the run ended with `0xc0000005 in VCRUNTIME140.dll`, the `process ends` line never came, and the process stayed "not responding" with 29 GB committed for 4 minutes until it was killed by hand (the same happened in a second run). A thread started with the crash handler waits for the first unhandled exception, then gives the process `XCL_CRASH_EXIT_SECONDS` (default 30; 0 turns it off) to end by itself, and ends it through the real `NtTerminateProcess` (not our hook, whose thread dump could hang the same way) with status 0xC0000005. A process that ends in time is left alone. **What is in it** - `crates/xcl/src/eh.rs`: `crash_exit_seconds`, `crash_deadline` (takes the end action as a closure, so it can be tested), `end_process_now`, the thread started in `install_crash_handler`, and `CRASHED` set at the top of `unhandled_filter`; three unit tests of `crash_deadline` (ends a process that does not end itself; leaves one that ends in time; waits for a crash first) - `tests/testtitle/src/main.rs`: `--hang-in-crash-filter` (a crash filter that sleeps forever, then a null write) - `crates/xcl/tests/e2e.rs`: `a_crash_filter_that_never_returns_does_not_keep_the_process_alive` runs it with `XCL_CRASH_EXIT_SECONDS=2`, kills the process tree if it is still alive after 120 s, and checks the log for the crash and for the deadline line **Tested** - NVIDIA GeForce RTX 3070 (32-lane waves), Intel i9-10900KF, Windows 11 Pro 10.0.26200, MSVC 19.44, rustc 1.100.0, debug build - `cargo test --workspace --no-fail-fast -- --test-threads=4` on this commit: 723 passed, 0 failed, 41 ignored - SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64) - The new e2e test passes in 4.3 s. It fails without the change: with `eh.rs` from main, the process is still alive after 120 s and the test fails with "the process was still alive 120 s after the title's crash filter hung" (120.8 s) **Regression run** (retail title, 60 s, release builds, default settings) main (6bac4b4): ``` xcl-smoke v1 commit: 6bac4b4419886acc940d479dcf8815d0b1804435 gpu: NVIDIA GeForce RTX 3070 title: dumped seconds: 60 exit: 0x0 frames shown: 1480 (PresentX 1480) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19520 MB ``` this PR (c997205): ``` xcl-smoke v1 commit: c997205f42d5edcf0ba4b5ec936a744364715286 gpu: NVIDIA GeForce RTX 3070 title: dumped seconds: 60 exit: 0x0 frames shown: 1534 (PresentX 1534) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17960 MB ``` **Not tested** - the real title with a hanging crash filter: the hang happened twice in my runs of the retail title, but not every crash, so I did not wait for one with this build; the title's crash filter is only simulated by the test title - AMD, Wine, a deadline other than 2 s and 30 s - whether 30 s is long enough for the title's crash filter to finish a normal report; it can be raised or turned off with `XCL_CRASH_EXIT_SECONDS` **AI use** - Claude Code, Claude Sonnet 5.5: found the hang in my runs, wrote the code, the tests and this description, and ran the test suite and the regression runs.
After an unhandled exception XCL logs the crash and hands over to the title's own crash filter.
A retail title's filter (a crash report of a process with tens of GB committed) can take very
long or never return: the run of an 8 GB card ended with `0xc0000005 in VCRUNTIME140.dll` and
the process stayed "not responding" with 29 GB committed until it was killed by hand; the
`process ends` line never came.

A thread started with the crash handler waits for the first unhandled exception, then gives the
process `XCL_CRASH_EXIT_SECONDS` (default 30, 0: off) to end by itself, and ends it through the
real `NtTerminateProcess` (not our hook, whose thread dump could hang the same way) with status
0xC0000005. A process that ends in time is left alone.

Tests: three unit tests of `crash_deadline`, and an end-to-end test: the fake title has
`--hang-in-crash-filter` (a crash filter that sleeps forever, then a null write). With the
deadline the run ends in 4 s; on main it is still alive after 120 s and the test fails.

Assisted-by: Claude Code (Claude Sonnet 5.5)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:38:36 +00:00
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 10:38 UTC · original

Linux / AMD RDNA3 datapoint, with a Wine caveat on the new test.

Merged state: head onto main 6bac4b4 (lane merge), clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 720 passed, 8 failed, 41 ignored; 7 are the known Wine-lane set from my #42 rows, and the 8th is this PR's new e2e test, failing 3/3 deterministically:

  • a_crash_filter_that_never_returns_does_not_keep_the_process_alive (crates/xcl/tests/e2e.rs) - fails at the unhandled exception 0xc0000005 log assert. Diagnosis from the captured xcl.log: the test title exits ~0.2 s after start, before it ever takes the crash - the log ends at DirectStorage: request #0 mid-startup, the xcl-crash-deadline thread is present and waiting, but no exception is ever logged. The process does exit non-success, so the first assert passes and the crash-logging assert fails.
  • I read this as the same Wine e2e family as the standing test_title_runs_and_game_folder_is_untouched failure on this rig (the testgame's startup path dies under Wine before the deliberate crash), not a defect in the deadline mechanism itself. The xcl run + testgame-under-Wine path can't validate this fix on Wine lanes until that e2e family is stable.
  • Everything else green, including the CLI exit-code plumbing the PR touches (#919's lane also covers that green).

Counts only, no game data. Full captured log on request.

Not tested: retail titles (none here), Windows, RDNA4.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 10:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/967#issuecomment-7129045295) Linux / AMD RDNA3 datapoint, with a Wine caveat on the new test. **Merged state:** head onto main `6bac4b4` (lane merge), clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** 720 passed, 8 failed, 41 ignored; 7 are the known Wine-lane set from my #42 rows, and the 8th is this PR's new e2e test, failing 3/3 deterministically: - `a_crash_filter_that_never_returns_does_not_keep_the_process_alive` (`crates/xcl/tests/e2e.rs`) - fails at the `unhandled exception 0xc0000005` log assert. Diagnosis from the captured `xcl.log`: the test title exits ~0.2 s after start, before it ever takes the crash - the log ends at `DirectStorage: request #0` mid-startup, the `xcl-crash-deadline` thread is present and waiting, but no exception is ever logged. The process does exit non-success, so the first assert passes and the crash-logging assert fails. - I read this as the same Wine e2e family as the standing `test_title_runs_and_game_folder_is_untouched` failure on this rig (the testgame's startup path dies under Wine before the deliberate crash), not a defect in the deadline mechanism itself. The `xcl run` + testgame-under-Wine path can't validate this fix on Wine lanes until that e2e family is stable. - Everything else green, including the CLI exit-code plumbing the PR touches (#919's lane also covers that green). Counts only, no game data. Full captured log on request. **Not tested:** retail titles (none here), Windows, RDNA4. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-24 10:40 UTC · original

Code/CI review only (not independently runtime-tested by me): clean merge and PR description green (just awaiting CI workflow approval). Cleanly enforces a 30 s exit deadline in xcl run if a title's crash filter stalls process termination. Recommend approving CI and merging, @⁠ivall.

**@⁠raylitebull** on GitHub · 2026-11-24 10:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/967#issuecomment-7129093018) Code/CI review only (not independently runtime-tested by me): clean merge and `PR description` green (just awaiting CI workflow approval). Cleanly enforces a 30 s exit deadline in `xcl run` if a title's crash filter stalls process termination. Recommend approving CI and merging, @⁠ivall.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 12:29 UTC · original

Independent verification, merged onto current main 384f7f7 locally (clean merge).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.

  • cargo build --workspace && cargo test -p xcl --test e2e: 4 passed, 0 failed — including the new a_crash_filter_that_never_returns_does_not_keep_the_process_alive, which verifies the 30 s crash-filter timeout ends the process (took ~3.4 s total for the suite).

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

**@⁠DavidM1911** on GitHub · 2026-11-24 12:29 UTC · [original](https://github.com/xcl-dev/xcl/pull/967#issuecomment-7131517577) Independent verification, merged onto current `main` `384f7f7` locally (clean merge). **Machine:** Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug. - `cargo build --workspace && cargo test -p xcl --test e2e`: **4 passed, 0 failed** — including the new `a_crash_filter_that_never_returns_does_not_keep_the_process_alive`, which verifies the 30 s crash-filter timeout ends the process (took ~3.4 s total for the suite). AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 03:23 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 03:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/967#issuecomment-7181675780) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
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/967/head:github-bot/gh-967'
git switch 'github-bot/gh-967'

Merge

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