Skip to content

state_transport_ipc: count a mutation after dispatching it (fixes ThreeEndpointFanOut flake) - #732

Merged
transfix merged 1 commit into
masterfrom
test/ipc-fanout-race
Oct 20, 2026
Merged

transfix merged 1 commit into
masterfrom
test/ipc-fanout-race

Conversation

@transfix

Copy link
Copy Markdown
Owner

Fixes the flaky StateTransportIpcTest.ThreeEndpointFanOut. It failed on #720's recipe / ubuntu-latest / Debug lane (job 118253162021): line 477 read "" for node B's fan instead of "hello".

Cause. The IPC transport's reader bumped _recv_mutations before dispatch_inbound() applied the mutation to the receiving shards. wait_for_received() polls that counter, so it could return while the value was still in flight, and the test then read the state too early. OOB messages had the same order (_recv_messages before dispatch_inbound_message()). state_transport_grpc already counts after dispatching.

Fix. Count after dispatch in the IPC transport, for both, and say so in the header. Once wait_for_received*() returns, the receiving shards have applied what it counted. That is what all 25 test call sites already assume. The counters are diagnostics: nothing but the waits and the total_received_*() accessors reads them. The test itself is unchanged. A probe showed each node receives exactly one mutation here (the two writes coalesce), so waiting for one is the right count.

Verified (Linux, Release, shared):

runs failed
master, 16 concurrent copies × 300 repeats of the test 4,800 5, all reading ""
this PR, 16 × 1,000 16,000 0
this PR, whole StateTransportIpcTest.* suite, 32 copies × 200 115,200 0

The other suites that use the IPC transport (state_multiprocess_ipc_test, state_reconnect_resilience_test, state_exec_multiprocess_test, state_snapshot_protocol_test) pass: 32/32 in ctest, with the two opt-in stress/perf tests skipped as usual. clang-format 18.1.8 is clean on the changed lines.

StateTransportIpcTest.ThreeEndpointFanOut failed on CI (#720,
recipe / ubuntu-latest / Debug): after wait_for_received(1) returned, node B's
"fan" was still "". The IPC reader bumped _recv_mutations before
dispatch_inbound() applied the mutation to the shards, so wait_for_received()
could return while the value was still in flight. OOB messages had the same
order. state_transport_grpc already counts after dispatching.

Count after dispatch, so wait_for_received*() returning means the receiving
shards have applied what it counted. The counters are diagnostics; nothing
but the waits reads them.

Reproduced on master: 16 concurrent copies x 300 repeats of the test failed
5 of 4800 times, every time with "". With the fix: 16 x 1000 passed 16000 of
16000, and the whole StateTransportIpcTest suite, 32 copies x 200 repeats,
passed 115200 of 115200. The other suites that use the IPC transport pass.
@transfix
transfix merged commit ccf0500 into master Oct 20, 2026
24 checks passed
@transfix
transfix deleted the test/ipc-fanout-race branch October 20, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant