fix(ipc) step over a run of lost events instead of one per poll() - #131
Open
TheophileDiot wants to merge 1 commit into
Open
TheophileDiot wants to merge 1 commit into
TheophileDiot wants to merge 1 commit into
Conversation
TheophileDiot
force-pushed
the
fix/ipc-poll-skip-lost-events
branch
from
September 7, 2026 15:35
cc9fc6c to
ab80fd7
Compare
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.
Fixes #130.
poll()advances one index per call when an event never arrives, so a run of lost events costs the full timeout on every call.broadcast()consumes its index atincr()beforeset()stores anything, so the hole is left both by an evicted event and by aset()that returnedno memory, and neither can be filled afterwards.When the retry loop times out this now walks forward to the next index the shm still holds and resumes just before it, capped at
MAX_HOLE_SCANso a single call cannot scan an unbounded range. When the cap is reached it resumes where the scan stopped, so a longer run costs one morepoll()per chunk rather than the events sitting behind it.poll()still returnsnil, "timeout", so the caller learns events were lost exactly as before, and TEST 12, 13 and 15 are untouched. The cold worker path from #87 is untouched too, since it fires atself.idx == 0before this code is reached.TEST 19 covers the walk: five events are deleted with a sixth left in place, and the first
poll()has to land on index 5 rather than index 1.We're carrying this as a patch on 2.7.0 in BunkerWeb. I couldn't run
provelocally, so the suite needs a CI run.