Repository navigation
fix: flush receiver writer after goodbye to close UTS-REVDD hang - #5674
Merged
Merged
Conversation
This was referenced Jun 11, 2026
oferchen
force-pushed
the
fix/uts-revdd-receiver-goodbye-flush
branch
3 times, most recently
from
June 11, 2026 18:30
ef83985 to
f91793c
Compare
… hang The receiver-role finalization sequence in `finalize_transfer` calls `handle_goodbye` and then returns without forcing the userspace writer buffer to drain. The upstream rsync `reverse-daemon-delta_test.py` scenario (OLD upstream client pushing to a CURRENT oc-rsync daemon receiver) hangs at the 300s test timeout because the buffered final NDX_DONE (and any trailing multiplexed MSG_INFO frames) never reach the wire before the peer blocks awaiting the echo. Upstream rsync calls `io_flush(FULL_FLUSH)` immediately after the receiver-side final NDX_DONE write in both `do_recv()` child (main.c:1067) and parent (main.c:1117/1123) paths. The generator role already mirrors this contract in `orchestrator::run` (UTS-15.c, commit a3bc2cb). This patch closes the same gap on the receiver side. The added flush tolerates early-close error kinds (BrokenPipe, ConnectionReset, UnexpectedEof, WouldBlock, ConnectionAborted) via the shared `is_early_close_error` predicate, re-exported at the crate root so generator and receiver share one definition. Any other I/O error propagates, preserving Rule 12 fail-loud behaviour. Regression coverage in `errors_and_timeouts::finalize_flush_tests`: - `finalize_transfer_proto28_flushes_after_goodbye` - the final operation before return must be a flush, not a write. - `finalize_transfer_tolerates_broken_pipe_on_tail_flush` - peer closing the socket between the goodbye write and the tail flush must not surface a spurious error. - `finalize_transfer_surfaces_non_close_errors_on_tail_flush` - any non-close flush error still propagates. No impact on the parallel-receive-delta, io_uring, IOCP, flat-flist, or daemon-tls paths - all of them share the same `finalize_transfer` exit and benefit equally from the added flush.
oferchen
force-pushed
the
fix/uts-revdd-receiver-goodbye-flush
branch
from
June 11, 2026 18:32
f91793c to
e59c23a
Compare
3 tasks
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
… hang (#5674) The receiver-role finalization sequence in `finalize_transfer` calls `handle_goodbye` and then returns without forcing the userspace writer buffer to drain. The upstream rsync `reverse-daemon-delta_test.py` scenario (OLD upstream client pushing to a CURRENT oc-rsync daemon receiver) hangs at the 300s test timeout because the buffered final NDX_DONE (and any trailing multiplexed MSG_INFO frames) never reach the wire before the peer blocks awaiting the echo. Upstream rsync calls `io_flush(FULL_FLUSH)` immediately after the receiver-side final NDX_DONE write in both `do_recv()` child (main.c:1067) and parent (main.c:1117/1123) paths. The generator role already mirrors this contract in `orchestrator::run` (UTS-15.c, commit caa1aa4). This patch closes the same gap on the receiver side. The added flush tolerates early-close error kinds (BrokenPipe, ConnectionReset, UnexpectedEof, WouldBlock, ConnectionAborted) via the shared `is_early_close_error` predicate, re-exported at the crate root so generator and receiver share one definition. Any other I/O error propagates, preserving Rule 12 fail-loud behaviour. Regression coverage in `errors_and_timeouts::finalize_flush_tests`: - `finalize_transfer_proto28_flushes_after_goodbye` - the final operation before return must be a flush, not a write. - `finalize_transfer_tolerates_broken_pipe_on_tail_flush` - peer closing the socket between the goodbye write and the tail flush must not surface a spurious error. - `finalize_transfer_surfaces_non_close_errors_on_tail_flush` - any non-close flush error still propagates. No impact on the parallel-receive-delta, io_uring, IOCP, flat-flist, or daemon-tls paths - all of them share the same `finalize_transfer` exit and benefit equally from the added flush.
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.
Summary
writer.flush()afterhandle_goodbye()in the receiver-rolefinalize_transfer, mirroring upstreamio_flush(FULL_FLUSH)indo_recv()atmain.c:1067/1117/1123.is_early_close_errorpredicate re-exported at the crate root; any other I/O error propagates.orchestrator::runby commit a3bc2cb ("explicit goodbye flush + arg rejection") so both roles drain buffered NDX_DONE frames before the transport FIN.Why
The upstream rsync
reverse-daemon-delta_test.pyscenario - OLD upstream client pushing to a CURRENT oc-rsync daemon receiver - hangs at the 300s test timeout because the receiver-role finalization incrates/transfer/src/receiver/transfer/phases.rsreturns with the final NDX_DONE (and any trailing multiplexed MSG_INFO frames) still sitting in the userspace writer buffer. The peer blocks on the echo that never arrives.Upstream main.c calls
io_flush(FULL_FLUSH)immediately after the receiver-side final NDX_DONE write in bothdo_recv()child (line 1067) and parent (lines 1117/1123) paths. We mirror that contract.Test plan
crates/transfer/src/receiver/tests/errors_and_timeouts/finalize_flush_tests.rs:finalize_transfer_proto28_flushes_after_goodbye- the final operation before return is a flush, not a write.finalize_transfer_tolerates_broken_pipe_on_tail_flush- peer closing between the goodbye write and the tail flush does not surface a spurious error.finalize_transfer_surfaces_non_close_errors_on_tail_flush- any non-close flush error still propagates (defense-in-depth against silently swallowing real I/O failures).finalize_transferexit and benefit equally from the added flush. The change is purely additive: an extra flush after the goodbye where the writer buffer is already drained byhandle_goodbyein the typical case.is_early_close_errortolerance, same Rule 12 fail-loud semantics for other error kinds.References
main.c:1067-do_recv()childio_flush(FULL_FLUSH)after the receiver writes its final NDX_DONE.main.c:1117/main.c:1123-do_recv()parentio_flush(FULL_FLUSH)afterhandle_stats(-1)and after the final NDX_DONE write.orchestrator::run.