Bug: tint lookup spins forever on a missing key (freeze when the house repairs task completes) #553

Open
github-bot wants to merge 1 commit from github-bot/gh-553 into main AGit
Owner

@⁠dot-mike on GitHub · 2026-12-06 02:25 UTC · original
dot-mike:fix/tint-lookup-hang-upstream → main · +49 −0 · 2 files · 1 commits · open

The game freezes for good when the house repairs task completes. No frame begins again, and after 20 s larp logs larp_gpu::stall: no frame begun for 20 s. It also happens with no mods loaded.

Where it hangs

  • When the chores finish, the only running game thread is a render worker. The call chain is thread entry → 0x25D8000 → 0x317F0 → 0x31890 → 0x50EB750.
  • 0x31890 walks a per-view list of objects. For each one it calls 0x50EB750.
  • 0x50EB750 turns the object into a handle and looks it up in a global hash table (image+0x876FC50, size at image+0x876FC48). The value it finds is a 16-bit colour or tint, which goes into an ARGB colour for the draw.
  • The lookup checks 16 slots at a time for a match and moves to the next group if none matches. It never checks for an empty slot (0x80), so a missing handle makes it loop forever. That's the freeze:
    • 0x50EB826 je (no match) → 0x50EB9D1 inc eax; jmp 0x50EB80F (next group);
    • in the dump, it's at group 0x6F of 128.
  • The game assumes every listed object is in the table. Even a null object gets a fixed key (0x1FFFF). So the freeze means an object was still in the render list after its table entry was removed.

Fix

hooks::tint_lookup_exit, retail build only, called next to constant_uploads before the title runs:

  • The 7 bytes at +0x50EB9D1 (inc eax; jmp +0x50EB80F) become a jump to 34 bytes of int3 padding at +0x55E824D. It doesn't overlap SETTINGS_CAVE.
  • There the patch tests the current group for an empty slot with vpmovmskb. If one is there, the key is absent, and it returns through the function's own exit at +0x50EB910. Otherwise it does what the stock bytes did.
  • Both writes go through larp_loader::patch with the stock bytes checked first.

The result: an object missing from the table draws without its tint for that frame, and the render worker no longer hangs. Lookups of keys that are in the table are unchanged.

Testing

  • I found the hang with procdump -mm on the frozen process. One thread was in larp-image+0x50EB826, and all the others were waiting.
  • With the patch, the log shows hook: tint lookup returns on a missing key. Completing the task shows "house repairs complete", and the game keeps running. I tested this on a build of this patch on top of a local branch.
  • This branch, on current main, builds with cargo build --release -p larp.

Known limit

The early exit is exact if entries are never removed one at a time. I only found inserts into the first group with room, and a clear of the whole table. If a single-entry delete exists, a key past a freed slot could be missed. That object would draw without its tint for a frame.

🤖 Generated with Claude Code

**@⁠dot-mike** on GitHub · 2026-12-06 02:25 UTC · [original](https://github.com/gamingwithhomie/larp/pull/553) `dot-mike:fix/tint-lookup-hang-upstream` → `main` · +49 −0 · 2 files · 1 commits · open The game freezes for good when the house repairs task completes. No frame begins again, and after 20 s larp logs `larp_gpu::stall: no frame begun for 20 s`. It also happens with no mods loaded. ## Where it hangs - When the chores finish, the only running game thread is a render worker. The call chain is thread entry → `0x25D8000` → `0x317F0` → `0x31890` → `0x50EB750`. - `0x31890` walks a per-view list of objects. For each one it calls `0x50EB750`. - `0x50EB750` turns the object into a handle and looks it up in a global hash table (`image+0x876FC50`, size at `image+0x876FC48`). The value it finds is a 16-bit colour or tint, which goes into an ARGB colour for the draw. - The lookup checks 16 slots at a time for a match and moves to the next group if none matches. It never checks for an empty slot (`0x80`), so a missing handle makes it loop forever. That's the freeze: - `0x50EB826 je` (no match) → `0x50EB9D1 inc eax; jmp 0x50EB80F` (next group); - in the dump, it's at group `0x6F` of 128. - The game assumes every listed object is in the table. Even a null object gets a fixed key (`0x1FFFF`). So the freeze means an object was still in the render list after its table entry was removed. ## Fix `hooks::tint_lookup_exit`, retail build only, called next to `constant_uploads` before the title runs: - The 7 bytes at `+0x50EB9D1` (`inc eax; jmp +0x50EB80F`) become a jump to 34 bytes of int3 padding at `+0x55E824D`. It doesn't overlap `SETTINGS_CAVE`. - There the patch tests the current group for an empty slot with `vpmovmskb`. If one is there, the key is absent, and it returns through the function's own exit at `+0x50EB910`. Otherwise it does what the stock bytes did. - Both writes go through `larp_loader::patch` with the stock bytes checked first. The result: an object missing from the table draws without its tint for that frame, and the render worker no longer hangs. Lookups of keys that are in the table are unchanged. ## Testing - I found the hang with `procdump -mm` on the frozen process. One thread was in `larp-image+0x50EB826`, and all the others were waiting. - With the patch, the log shows `hook: tint lookup returns on a missing key`. Completing the task shows "house repairs complete", and the game keeps running. I tested this on a build of this patch on top of a local branch. - This branch, on current `main`, builds with `cargo build --release -p larp`. ## Known limit The early exit is exact if entries are never removed one at a time. I only found inserts into the first group with room, and a clear of the whole table. If a single-entry delete exists, a key past a freed slot could be missed. That object would draw without its tint for a frame. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The retail build's per-object tint lookup (+0x50EB750) probes its hash
table group by group until it finds the key. It never stops at an empty
slot, so an object still in a view's draw list after its table entry
was removed spins a render worker forever and no frame begins again.
This happens when the house repairs task completes.

The probe's step to the next group now goes through int3 padding that
returns through the function's own exit when the group has an empty
slot. The object then draws without its tint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-06 02:31:14 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/553/head:github-bot/gh-553'
git switch 'github-bot/gh-553'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-553'
git switch 'github-bot/gh-553'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-553'
git switch 'github-bot/gh-553'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-553'
git switch 'main'
git merge --squash 'github-bot/gh-553'
git switch 'main'
git merge --ff-only 'github-bot/gh-553'
git switch 'main'
git merge 'github-bot/gh-553'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.