Repository navigation
Conversation
…de a dump) us_send (19 ASK, 1C write-backs) took the MIDI mutex with ext_ui_lock, which checked the port, the ring's room and the free requests but not SYSEX_STATE, as ext_try_send does. In rytm-emu (1.74, sq_emu fillqueue, with the timing the big-ram series gives the ticks) a 0x19 ASK landed 12 bytes before the end of a 14,988-byte pattern dump, and the dump's tail was lost: the host got 6 whole answers of 7. ext_ui_lock now also returns 0 while SYSEX_STATE is set; the caller asks again on a later tick, as it does for a full ring. +8 B of code. Why the mutex was free inside the dump is not traced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while testing big RAM (#32). It's a fix to
dev's 0021 and stands on its own.The bug
us_send(the 19 ASK and the 1C write-backs) takes the MIDI mutex withext_ui_lock. That function checks the port, the ring's room and the free requests. Unlikeext_try_send, it doesn't checkSYSEX_STATE. In rytm-emu (1.74,sq_emu fillqueue), a 19 ASK landed 12 bytes before the end of a 14,988-byte stock pattern dump, and the dump's tail was lost: the host got 6 whole answers of 7.On
devthe test passes only because of the tick timing. The big-RAM series moves 0026's start-up by 3 ticks and 0029's by 1, and then it fails every time. Two controls show the timing exposes the race rather than causing it:devplus the same amount of dead code still passes;The fix
ext_ui_lockalso returns 0 whileSYSEX_STATEis set. The caller asks again on a later tick, as it already does for a full ring. +8 B of code.I haven't traced why the mutex was free inside the dump.
Tests
sq_emu fillqueuepasses with this on top of big RAM, all checks. With this fix alone ondev(Makefile release set, tagu33, verify PASS):suites.py u33 --changed upstream/devpicks 12 suites (us sfu md sq cu sv ar sp mi pc mrep sa44), all with the same counts asdev. +8 B.🤖 Generated with Claude Code