test(state): fix apply-barrier race in MultiProcessIpc.BidirectionalReplication - #543
Merged
Merged
Conversation
…eplication
The test used wait_for_received(1) as the sync point before reading the replicated
value from the tree. But wait_for_received counts frames DECODED by the reader
thread, not frames APPLIED to the tree, and inbound frames are ingested on
pump_all(). So the child checked `server_val == "from_server"` while only an earlier
frame (or nothing) had been applied, captured a stale value, and exited 12 ("child
did not receive server's value") — intermittently (~2/20 locally; it surfaced in the
recipe lane). The parent's `got_client` check had the identical latent race.
Fix: on both sides, poll the ACTUAL condition — pumping (pump_all/flush) so received
frames are applied — until the expected value appears or a 5s deadline passes,
instead of trusting the frame-decode counter. No product code changed.
Verified: 100/100 runs of BidirectionalReplication pass.
transfix
enabled auto-merge
October 2, 2026 17:09
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 the intermittent
MultiProcessIpcIntegration.BidirectionalReplicationfailure (child exits 12, "did not receive server's value") that surfaces in the recipe lane (which runs theIntegrationtests).Root cause (apply-barrier race): the test used
wait_for_received(1)as the sync point before reading the replicated value from the tree. Butwait_for_receivedcounts frames decoded by the reader thread, not frames applied to the tree — and inbound frames are ingested onpump_all(). So the child checkedserver_val == "from_server"while only an earlier frame (or nothing) had been applied, captured a stale value, and exited 12. Thefor(40)pump loop that actually applies the frames ran after the check. The parent'sgot_clientcheck had the identical latent race.Fix: on both sides, poll the actual condition — pumping (
pump_all/flush) so received frames are applied — until the expected value appears or a 5s deadline passes, instead of trusting the frame-decode counter.Verified: 100/100 runs of
BidirectionalReplicationpass (it reproduced ~1-2/20 before). Test-only; no product code changed.