Fix the audio stall that breaks the title at +0x4dcbc9d (frame 82) #211
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!211
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-211"
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?
@ktaylor9200 on GitHub · 2026-12-05 21:30 UTC · original
ktaylor9200:fix/audio-mix-lock-leak-upstream→main· +176 −0 · 4 files · 1 commits · merged 2026-12-05 21:40 UTCWhat this fixes
exit -2147483645(0x80000003) atlarp-image-b99f876b74d4a77f.dll+0x4dcbc9d, about 15 s after launch,Frame: 82in the game's crash log. Registers at the break:rax = 0x17fb0,rbx = 0x50,rsi = r8 = 0x6c0.That
int3is the overflow check in the game's audio command-buffer write. The game thread appends a 1,728-byte block of audio effect commands to a double buffer every tick, and the audio engine's update is supposed to empty it. Here the update never ran, so the buffer filled up.Root cause (a latent bug in the game)
engine+0x3cdf9 = 1, stream manager+0x52c = 0streams). The setup is the endpoint enumeration,ISpatialAudioClientand its render stream, all of which go to the host's COM.title+0x5267720(engine vtable+0x80). It takes the stream manager's lock, and when there are no streams it returns attitle+0x5267747(jeto a plain epilogue andret) without unlocking.title+0x1e95040) blocks on it in its next pass (title+0x5594650→ lock), nothing drains the buffers, and the game breaks.Seen live: the lock's owner is an idle job worker, with 3 waiters and recursion 1; the audio thread is blocked in the lock; the stream manager has 0 outputs and 0 streams. On a console the device setup does not fail, so this path is never reached.
The fix
All of it is in the build's hook table (
larp_game::hooks::AudioMixUnlock), with the image's bytes checked before anything is placed:je(0F 84 AE 05 00 00attitle+0x5267747) is pointed at the function's own unlocking exit (title+0x5267c7f:mov rcx, rdi, the same epilogue,vzeroupper,jmp unlock). The new bytes are0F 84 32 05 00 00. The stack frame andrdi(the manager) are as that exit expects, and the recursive lock's count stays balanced.aud_engine_set_no_output_q(title+0x5a65430, vtable+0x10) logs once when the game gives up on an audio output, and logs at info when it has one again.+0x4dcbc9d.With the fix the game keeps running instead of breaking. While it has no output it is silent, and the log says so. Whether sound comes back is up to the game: its device-recovery thread re-runs the setup on a device change.
Testing
On the
b99f876b74d4a77fbuild, Windows 11, RTX 5080:main5a1a042+ the fix): ran untilpipelines: every queued one is made, the title gets its input(60,621 pipelines), then 2 more minutes. No crash; frame 5,890 at the end; the command buffers never held more than one record.On the PC where this was seen, the device setup failed only on the first runs, while the default playback device had never had its spatial sound set. After it was set once (Windows Sonic for Headphones, then Off again) the setup succeeded every time, so the natural failure could not be reproduced afterwards. Which step of the setup failed is not known.
🤖 Generated with Claude Code