D3D12.X: end the title past the NtTerminateProcess hook #3172
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3172"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-28T15:53:39Z.
A title run that ends through
end_title(for exampleXCL_RUN_SECONDS, whichscripts/smoke.ps1uses) can stay alive forever instead of ending. Seen once today in about 85 smoke runs: the title ended at 60.4 s, the log'sprocess endsline came exactly 15.0 s later, and 20 minutes on the process was still there, not responding, with 145 threads suspended.smoke.ps1did not get its block and the queue behind it stood still.end_titlestarts a watchdog that ends the process after 15 s "whatever happens", suspends every other thread, drains the GPU and terminates. Both terminate calls usedTerminateProcess, which runs XCL's ownNtTerminateProcesshook. With the other threads suspended, that hook formats and writes a log line (heap allocation, the log file mutex, an echo to stderr through std's stderr lock) and flushes the log. A suspended thread that holds one of those locks blocks the watchdog for good. The 15.0 s gap shows the watchdog was the caller (the drain was stuck), and 147 live threads show the kernel had not been asked to terminate yet. I found no issue or PR for this (searched "xcl-end-watchdog", "NtTerminateProcess hook", "process does not exit", "smoke.ps1 hangs").What is in it
eh.rs:terminate_unhooked(code)calls the originalNtTerminateProcess(orTerminateProcesswhen the hook is not installed). No allocation, no lock.real.rs:end_title's watchdog and its final terminate use it. The two used-pipeline journal flushes the hook did now run before the threads are suspended, next to the log flush that was already there; with their writer thread suspended they could only time out.process endsline. On theend_titlepath that line is gone.eh::tests::terminate_unhooked_ends_past_a_suspended_stderr_holder: a child process installs the hook, suspends a thread that holds the stderr lock and terminates. It must end with the given code within 20 s.Tested
TerminateProcess: 0 passed, 1 failed ("the process did not end within 20 s"). With the change: passes.cargo test -p xcl --lib eh:: -- --test-threads=2: 11 passed, 0 failed.cargo test -p xcl --test e2e -- --test-threads=1: 5 passed, 0 failed.cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4, one run on head2cc7279e: 2149 passed, 4 failed, 48 ignored (25SKIPPEDlines). The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0to_3, which also fail onmainhere (10d27297: 2148 passed, 4 failed, 48 ignored; #1919 fixes them).Regression run
scripts/smoke.ps1 -Seconds 60 -Title 9cc6a39e(Newer Retail Game), release builds in clean trees,main10d27297first, one run each,XCL_PREPARE=0, same DXIL cache. Both runs end throughend_title, so the PR's run also shows the changed path ending the process normally.main(10d27297):This PR (
2cc7279e):Not tested
used-pipelines.txt, because the journals are flushed slightly earlier.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T23:48:24Z.
Two contributors checked independently and found that #2698 solves the same problem in a different way: #1607, group D154. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-29T11:04:59Z.
Closing as a duplicate of #2698, which was merged last night. It makes the same change: the end-of-run watchdog now ends the process through
eh::end_process_now, which calls the realNtTerminateProcessand skips the hook, and its test holds the process heap in another thread. The hook is where my run was stuck too, somainalready has what this PR was for.Pull request closed