Hang watch: each game event and semaphore keeps its last operations #47
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/ThatRecompDev--five-star-recomp!47
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/47/head"
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?
@Sr-0w on GitHub · 2026-11-25 17:30 UTC · original
Sr-0w:diagnostics/wait-object-history→main· +351 −20 · 8 files · 2 commits · merged 2026-11-25 22:11 UTCA game run reached the opening cutscene, then hit the game's 30 s watchdog. The wait-object report showed a cycle:
B had signaled the idle event 0.2 s before A started waiting on it. So the signal was either taken by another wait or dropped in between. The report couldn't tell which: it kept only the last signal, and the shims saw neither
ResetEventnorWaitForMultipleObjects, though the game imports both.Change:
ResetEventandWaitForMultipleObjectsget pass-through shims under--watch-hang, like the other wait-object calls. They are removed otherwise.Test: a signal, a multi-object wait that it ends, a reset and a blocked wait are listed in order with their threads, and the wake-up that follows is recorded. Loader tests and architecture rules pass. Docs are in
debugging.md.🤖 Generated with Claude Code
@ThatRecompDev on GitHub · 2026-11-25 19:08 UTC · original · edited 2026-11-25 19:09 UTC
this is really useful, the "signaled 0.2 s before the wait" story is exactly what the old report couldn't show.
couple of things before merging though:
Signaled and Done now call Caller(), which does the full 64 KB / 6-frame scan on every SetEvent/ReleaseSemaphore/ResetEvent and every wake, just to keep the first address. with the hang watch on, that adds work to exactly the paths whose timing we're watching. could you scan for 1 frame there (or reuse the frames the wait already found)?
DoneOnSeveral drops timeouts and abandoned results, so a multi-wait that times out leaves nothing, while single waits record "timed out".
the blocked line only names handles[0] for a multi wait, maybe say "one of N".
off-mode is fine, since the shims get removed without --watch-hang.
heads up too: main got a fix in ReturnAddresses.Scan last night (it only reads the call bytes when their page is committed,
98d9727). it crashed a boot from inside the wait shim, so more Caller() calls go through that path now@Sr-0w on GitHub · 2026-11-25 21:21 UTC · original
Thanks, done (rebased on main, so it goes through 98d9727's
CallBytesReadable):Signaled,Resetand every wake-up now scan for one frame (GameFrames(1)), stopping at the first game return address. Creations and waits keep 6 frames, andDoneOnSeveralscans once for all its objects.DoneOnSeveraltakesalland records the result on the objects:WAIT_ABANDONED_0 + i→ "abandoned" on that object;on one of 3 handles (0x.., 0x.., 0x..), the first 0x..: <first described>(orall of).New test
A_wait_on_several_objects_names_them_all_and_its_timeout_stays_on_each. WaitObjects tests 11/11.@Sr-0w on GitHub · 2026-11-25 21:57 UTC · original
In game: this history is what found the watchdog cause fixed by #49. The run with it showed:
CreatePipelineStateat 5, 15 and 25 s.That ruled out a lost wake-up. With #49 on top, runs reach the opening cinematic (loading screens at 30 fps, then the world at 9–14 fps) and last 600 s without the watchdog.
@ThatRecompDev on GitHub · 2026-11-25 22:11 UTC · original
thanks, all three changes are in and they read well. the one-frame scan in Signaled/Done, timeouts and abandoned results recorded for multi-waits, and the "one of N" wording.
merged into main (
566a88d). i fixed one architecture rule on the way in (the property pattern in Target became a local and a plain null check), so no need to touch it.two small things if you ever come back to it: a signal from a thread with no game frames still scans the full 64 KB, and the WaitForMultipleObjects shim reads the handle array before kernel32 does, so a bad pointer would crash instead of returning WAIT_FAILED. not urgent