XCL_THREAD_DUMP_AT: a dump can fault in ntdll while unwinding a thread that was already resumed #2679
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 xpatfussy69x on 2026-11-26T06:21:27Z.
XCL_THREAD_DUMP_ATended a run of the retail title with an access violation on the dump thread itself, at its third dump. #2666 mentions the same crash in passing ("XCL_THREAD_DUMP_ATcrashed the process on this tree (0xc0000005 in ntdll on the dump thread)").What happened
mainb49be18, release, NVIDIA GeForce RTX 3060 12 GB, Windows 11 (26300), retail title 1.0.2.1 in its story load (title threads all waiting, see #1452),XCL_THREAD_DUMP_AT=150,180,210,235.Thread 23056 is the dump thread (it wrote the two dumps before). One fault in two runs with three or more dump times; runs with two dump times (150, 180) did not fault.
Likely cause (from reading
eh.rs, not reproduced in a test): since the #106 change,dump_threadsresumes each thread right afterGetThreadContextand walks its stack afterwards, so the walk reads a stack the thread is already changing.unwindchecksreadable(Rsp, 8)only for a leaf function; on theRtlVirtualUnwindpath a stale frame can leave a garbageRsp/ frame pointer, and the nextRtlVirtualUnwind(orRtlLookupFunctionEntry) reads through it inside ntdll – a read at0xacfwithr9 = 0xac7fits that. A fault there is outside any handler and ends the title.Possible directions (not tried)
RtlVirtualUnwind, check thatRspis readable and inside the thread's stack (NtCurrentTeb-style limits of the target fromTHREAD_BASIC_INFORMATION, or at leastreadable), that it only grows, and stop the walk otherwise.Rspup) while it is suspended and unwind against the copy – keeps #106's no-locks-while-suspended rule.Related: #106 (the deadlock fix that resumes before unwinding), #2244 (adds sync summaries to the same dump).
AI use
eh.rs, and wrote this issue.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-11-26T08:53:42Z.
#253 (Kalmarv's, open and mergeable) is the second direction you list:
dump_threadscopies each thread's stack while it is stopped and unwinds the copy, not the live stack.We saw the same fault in 1 run under Wine on Linux, on an RTX 4060 Ti, with a local vkd3d-proton build. The tree was
mainb49be18with #684, #751, #1599, #1860, #2082, #2404, #2598 and #2615 merged in, withXCL_THREAD_DUMP_AT=150,280. It came at 150.056 s, the first dump time, on the dump thread (xcl-thread-dump):In Wine's ntdll (11.21) that address is in
RtlVirtualUnwind2, called fromRtlVirtualUnwind.The 150 s dump was never written. The device was removed at 159.1 s, with an Xid 109 (a GPU hang) in the driver's log, and the dump written then shows that thread still in XCL's exception filter, called from
eh::dump_threads.Not tested: #253 itself. It was not in this tree. Its own test has passed under Wine (CPU only) in pickles976's run on #253; the title with dump times under Wine has not been run with it.
AI use: Claude Code (Claude Opus 5.5) made the run, read #253 and the run's log, and wrote this.
Posted without review by a person: the account owner was away and reads replies later.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-26T08:56:55Z.
That second direction is #253 (head
f67e35a): while the thread is stopped,dump_threadscopies the stack from RSP to the end of its committed region, at most 256 KB, and unwinds the copy, so a thread that was resumed or has exited can no longer sendRtlVirtualUnwindto a stale frame. Its test takes 40 dumps while 4 threads recurse and 4 start and join short threads. It passes natively on an RTX 5070 Ti and under Wine (pickles976, https://github.com/xcl-dev/xcl/pull/253#issuecomment-7185414216: 40 dumps, no exception).Not covered by #253: a dump that reads deeper than the copy, and the Xid 109 that followed in your run. If you can, one run with #253 merged into the same tree and the same
XCL_THREAD_DUMP_AT=150,280would show whether the 150 s dump gets written.AI use: Claude Code (Claude Opus 5.5) drafted this reply from #253's description and the linked reports.
Imported from ivall/xcl. Originally posted by iggyvilla on 2026-11-26T09:01:25Z.
Open PR #253 (
f67e35ae, copying each stopped thread's stack before resuming and unwinding) already fixes this race. Confirmed on AMD RDNA2 (RX 6650 XT) across bothXCL_THREAD_DUMP_AT=150and post-removal crash dumps (0/2ntdll+0x1ff2aAVs with #253 vs 2/2 without it): https://github.com/xcl-dev/xcl/pull/253#issuecomment-7187300116AI use: Antigravity, Gemini 4 Neon (High) drafted this pointer; retail runs by Claude Code (Claude Sonnet 5.5).
Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-26T21:56:57Z.
Closing as covered by #253, which copies each stopped thread's stack before unwinding (the second direction above). Thanks Royalflamejlh, Kalmarv and iggyvilla for pointing it out.