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

Open
milas6669 wants to merge 1 commit from upstream-pr/967 into main
milas6669 commented 2026-11-24 09:38:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by milas6669 on 2026-11-24T09:38:44Z.


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.
<!-- greyfinch-sync:ivall/xcl:issue:5469672279 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/967). Originally posted by [milas6669](https://github.com/milas6669) on 2026-11-24T09:38:44Z. --- 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.
SlopTart commented 2026-11-24 11:05:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T10:38:16Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7129045295 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/967#issuecomment-7129045295). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-24T10:38:16Z. --- 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.
raylitebull commented 2026-11-24 11:05:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-24T10:40:25Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7129093018 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/967#issuecomment-7129093018). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-24T10:40:25Z. --- 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.
DavidM1911 commented 2026-11-24 13:03:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T12:29:40Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7131517577 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/967#issuecomment-7131517577). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T12:29:40Z. --- 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 commented 2026-11-26 04:07:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T03:23:23Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7181675780 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/967#issuecomment-7181675780). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T03:23:23Z. --- 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
github-actions[bot] commented 2026-11-30 08:41:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:41:57Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7273232039 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/967#issuecomment-7273232039). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-30T08:41:57Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 04:33:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:33:18Z.


Triage (#1607) – head c997205

Related: #742 attacks one cause of the same hang. It declines the title's in-process MiniDumpWriteDump. This PR adds a general deadline after any unhandled exception, so the two complement each other.
Problem: main now has pub(crate) unsafe fn end_process_now(status: i32) in eh.rs (88f29d1, same body). The PR adds its own unsafe fn end_process_now. Git merges the two cleanly, but the merged file defines the function twice and does not compile. Drop the PR's copy and use main's.
Minor: CRASHED is set on every entry to unhandled_filter and never cleared. If the title's filter returns EXCEPTION_CONTINUE_EXECUTION, a process that keeps running is ended 30 s later.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7300851230 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/967#issuecomment-7300851230). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:33:18Z. --- **Triage (#1607)** – head c997205 Related: #742 attacks one cause of the same hang. It declines the title's in-process `MiniDumpWriteDump`. This PR adds a general deadline after any unhandled exception, so the two complement each other. Problem: main now has `pub(crate) unsafe fn end_process_now(status: i32)` in `eh.rs` (88f29d1, same body). The PR adds its own `unsafe fn end_process_now`. Git merges the two cleanly, but the merged file defines the function twice and does not compile. Drop the PR's copy and use main's. Minor: `CRASHED` is set on every entry to `unhandled_filter` and never cleared. If the title's filter returns `EXCEPTION_CONTINUE_EXECUTION`, a process that keeps running is ended 30 s later. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/967:upstream-pr/967'
git switch 'upstream-pr/967'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/967'
git switch 'upstream-pr/967'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/967'
git switch 'upstream-pr/967'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/967'
git switch 'main'
git merge --squash 'upstream-pr/967'
git switch 'main'
git merge --ff-only 'upstream-pr/967'
git switch 'main'
git merge 'upstream-pr/967'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!961
No description provided.