Stack dumps: unwind a copy of each thread's stack, LARP_STACKS_AT_KILL, LARP_TITLE_WATCHDOG (part c of #77) #140
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/gamingwithhomie--larp!140
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-140"
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?
@kadiratesdev on GitHub · 2026-12-05 19:31 UTC · original
kadiratesdev:pr/split-c-stacks→main· +266 −14 · 7 files · 4 commits · merged 2026-12-06 00:07 UTCThis is part (c) of the split @gamingwithhomie asked for on #77. It is independent of part (b) (diagnostics, #126) and part (a) (Agility/d3d12.dll loader). It touches no file those two touch, except the docs tables (separate rows, merged cleanly with both in a local trial merge). Based on the same
mainas #126 (334be94).Per the review, do not merge before a
LARP_STACKSstall-dump sanity run on a real machine: the stack walk is the part I have not been able to exercise in-game (see Testing).What is in it
LARP_STACKSwalked each suspended thread's live stack withRtlVirtualUnwind, which reads through a frame register that can hold anything where the thread was stopped, or through stack pages the thread never committed. In VIctory-NVIDIA that ended the process with an access violation inside ntdll.frames_ofnow copies the stack (fromrspup, at most 512 KiB, zeros after) withReadProcessMemorywhile the thread is suspended, resumes it, and unwinds the copy (crash::unwind_copy).unwind_into, the crash handler's live walk, stops where a frame register lies outside the thread's stack.LARP_STACKS_AT_KILL=1(off by default; ported from VIctory-NVIDIA c6d5c4d7): when the title's 30 s watchdog kills the run (write to address 0,+0x23cf683), print every other thread's stack once, to show what the frame loop was stuck in.LARP_TITLE_WATCHDOG=0(off by default; ported from VIctory-NVIDIA aee4c45a): sets the watchdog's quit flag (bit 0 of the byte at title+0x71b6340) every half second, only on build 1.0.2.1 and only when the trap bytes at+0x23cf683match. A 30 s stall that larp does not already feed the heartbeat for is then not ended as a crash. It is opt-in because a real hang then stays a hang. On any other build it prints that it left the watchdog alone.environment-variables.md, and the+0x2215c35/+0x23cf683entry introubleshooting-and-crashes.md).Dependencies
LARP_STACKSwalk itself (and the crash handler's walk stopping at an off-stack frame register). Both only run when something is already dumping stacks or crashing.Testing
x86_64-pc-windows-msvc. Same warning set as currentmain.cargo test --release --workspaceunder Wine: everything passes except the one test that also fails onmain(larp-game prompts::font::...within_its_advance).LARP_STACKSstall-dump sanity run: in progress, not finished. I have not yet completed a 120 s run withLARP_STACKS=60,120on Windows with this branch. Plan (results will be posted as a comment on this PR):LARP_STACKS=60,120: start, keep the process running past 120 s (title screen is enough), confirm stderr containslarp: stacks of N threadstwice, and that the game kept running afterwards.WM_CLOSEon thelarpclass window).LARP_TITLE_WATCHDOG=0shows the "told to quit" line on 1.0.2.1.LARP_STACKS_AT_KILL=1only prints when the 30 s watchdog really fires, so it cannot be checked on demand.@copilot-pull-request-reviewer[bot] on GitHub · 2026-12-05 19:31 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
@gamingwithhomie on GitHub · 2026-12-05 20:43 UTC · original
Holding per your own note (needs a real
LARP_STACKSstall-dump sanity run first). Post that run and we will test-merge part (c). Parts (b) #126 is already merged. Thank you!@kadiratesdev on GitHub · 2026-12-05 22:43 UTC · original
LARP_STACKSstall-dump run, RTX 3080 Ti (driver 621.47), Windows 11 build 26300. This PR's head35d5c01, cross-built release, run from a scratch copy ofbinwith a scratchLARP_DATA_DIR. Both runs usedrun <game> --execute --console series-s -- -skipToIISand were closed through the window (SC_CLOSE, exit code 0).1. Stall-triggered dump (normal release build, no
diagnosticsfeature),LARP_STALL_S=1no frame begun for 1 s (frame 12070)with 7 threads of ours inPipelineMake.stall: ...; every thread's stack follows (said once)andlarp: stacks of 141 threads: 1535 frames in total.larp-image-<hash>.dll+rva), 53 threads started there, pluslarp-c.exe,ntdll,nvwgf2umx/nvgpucomp64andD3D12Core.2. Scheduled dumps (
--features diagnosticsbuild of the same commit),LARP_STACKS=60,120larp: stacks of 140 threadseach, with 1268 and 1180 frames. The first has 241 frames in the title image.Not tested:
LARP_STACKS_AT_KILL=1(no watchdog kill happened),LARP_TITLE_WATCHDOG=0, a real long hang in gameplay, Wine/Proton, and AMD. Each run lasted 2 to 4 minutes, up to the title's first screens.