Repository navigation
xcl run: the end of a run ends the process past XCL's own exit hook - #2698
Royalflamejlh wants to merge 1 commit into
Conversation
luckyteagirl
left a comment
There was a problem hiding this comment.
The child regression can report exit 7 without exercising the heap-held hook path. install_crash_handler() logs a hook-install failure but returns normally, and the child ignores HeapLock's BOOL before setting HELD. If the hook did not install, end_process_now sees ORIG_NT_TERMINATE == 0 and its TerminateProcess fallback can exit 7 through the normal unhooked path; if the heap lock failed, the old watchdog path would also lack the intended blocked-heap condition. The parent only checks exit 7, so either missing prerequisite can yield a green test.
Could the child assert that ORIG_NT_TERMINATE is nonzero after installation and that HeapLock succeeds before it signals HELD? That would make the test fail visibly when the environment cannot exercise the regression. This is an exact-head source review of 95fc91c3c9d46c06b15952ac4bd641db1cc83cf7; I did not inject either failure or rerun the test. AI-assisted review with Codex.
`end_title` suspends the title's threads, drains the GPU and ends the
process, with a watchdog that ends it within 15 s if the drain hangs:
"a suspended thread may hold a lock the drain needs". The watchdog
ended the process through `TerminateProcess`, so through XCL's
`NtTerminateProcess` hook, which formats the stack and a log line
first. When a suspended thread holds the process heap, the drain and
then the watchdog both wait for it, and the process does not end. On
Linux (Wine) the runs of today's trees log the drain's wait and, in
about half of them, the watchdog's ("main process heap section wait
timed out in thread …"), and then never exit.
The watchdog now calls the real `NtTerminateProcess`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
95fc91c to
88f29d1
Compare
|
@luckyteagirl yes: both could pass unseen. A hook that failed to install is only logged (
AI use: Claude Code (Claude Opus 5.5) made the change, ran the tests and the smoke run, and wrote this reply. Posted without review by a person: the account owner was away and reads replies later. |
|
Test report: passes on NVIDIA. Exact head Tested
Not tested
Claude Code (Claude Opus 5.5) ran the tests and wrote this report. |
|
Independent RTX 4060 (8 GB) / Windows 11 verification of PR #2698 at Setup
Targeted RTX 4060 release unit tests (
|
|
Independent AMD RDNA4 (native wave64) verification of exact PR head Tested
(Compare against Not tested
AI use
|
The end of a run (
XCL_RUN_SECONDS,real::end_title) no longer hangs when a suspended thread holds the process heap.end_titlesuspends the title's threads, signals the fences and drains the GPU; its 15 s watchdog is the last resort when that drain cannot finish ("a suspended thread may hold a lock the drain needs"). The watchdog ended the process withTerminateProcess, that is through XCL's ownNtTerminateProcesshook (eh.rs), which formats the stack and a log line, and so allocates, before the real call. In half the runs on one Linux machine of ours the watchdog waited there as well, and the process did not end. It now calls the realNtTerminateProcess. The drain itself can still wait for the held heap; such a run now ends at the watchdog's 15 s instead of never.Under Wine this shows as a run that does not exit:
err:sync:RtlpWaitForCriticalSection section … "dlls/ntdll/heap.c: main process heap section" wait timed out in thread …. In 6 runs on Linux (RTX 4070, Wine with vkd3d-proton) ofmainb49be18with #684 (alone, with #1599 or with #1790; 2 runs each), every run logged that wait in the thread that ranend_title. 3 were ended at 15 s by the watchdog, through the hook (process ends (thread …), that thread's only line). The other 3 logged a second wait, in a thread that had logged nothing, and had not exited a minute later, when the harness killed them. We take that thread to be the watchdog: after the suspension it is the only other thread still running.What is in it
crates/xcl/src/eh.rs:end_process_now, which ends the process through the realNtTerminateProcess. xcl run: end the process when the title's crash filter has not ended it in 30 s #967 adds the same function under the same name, for its crash watchdog. The two merge without a conflict but do not build together, so whichever goes in second drops its copy (and if that is this one, makes xcl run: end the process when the title's crash filter has not ended it in 30 s #967'spub(crate)).crates/xcl/src/hle/d3d12x/real.rs:end_title's watchdog calls it. An ending after a drain that finishes still goes through the hook. With D3D12.X: batch used-pipelines.txt writes off the bind lock #2635 in,used-pipelines.txtis still flushed beforeend_title(shutdown_used()inhost.rs); the watchdog's ending skips only the hook's bounded second flush.the_process_ends_while_another_thread_holds_the_heap: a child process with the crash handler installed, a thread holding the process heap (HeapLock), then the watchdog's ending; the parent waits 20 s for its exit code. The child first checks that the hook is installed and thatHeapLocksucceeded, then ends with status 7, so a child that returns normally, or that never held the heap, cannot pass. In the hook a non-zero status takes thedump_threadsbranch, whereend_title's 0 takes theprocess endsline; both allocate.Tested
88f29d1onmainb49be18.TerminateProcessthrough the hook): failed, the child had not ended after 20 s (the process did not end while another thread held the heap). On this branch it passes, with the other sixeh::tests.cargo test --workspace --no-fail-fast -- --test-threads=4: 1,436 passed, 0 failed, 47 ignored. 29 SKIPPED lines: 21 no wave64, 3 wave32 per-lane forms refused, 3 no D3D12 debug layer, 1 no heap windows, 1pso_measurement_compiles_an_exact_synthetic_record(the driver cache cannot be turned off without Windows Developer Mode).mainb49be18with XG: fix CopyFromSubresource 7-argument ABI and guard destination span #684 and DirectStorage: a queue made with AutoSubmitDisabled waits for Submit #1599 merged in, 120 s a run, 4 runs each way, alternating; the first-run screens were completed once, no story progress. Without this change, all 4 runs logged the wait for the heap in the thread that ranend_title: 3 had not exited a minute after the end of the run and were killed, and 1 ended at the watchdog, through the hook. With it, 3 of 4 logged the same wait and ended 15 s after the end of the run, at the watchdog; the fourth, which met D3D12.X: title texture reads outside the coherent window use the safe copy #751's read fault inmsvcrt.dllat 33.0 s, logged no wait and ended 10 s after, through the hook as before. Commits543756dand0108f24(the same with this change:0108f24has it as at95fc91c;88f29d1changes only the test).Regression run
main:
PR:
Not tested
blocked by …), but in 12 of the 13 runs here that logged the wait, it had logged nothing.AI use