Repository navigation
fix: end each transfer phase and send NDX_DEL_STATS on upstream's schedule - #8295
Merged
Merged
Conversation
oferchen
added a commit
that referenced
this pull request
Nov 3, 2026
oferchen
added a commit
that referenced
this pull request
Nov 4, 2026
oferchen
force-pushed
the
fix/generator-phase-ndx-done
branch
from
November 4, 2026 02:08
0ec35de to
c81ad75
Compare
oferchen
added a commit
that referenced
this pull request
Nov 4, 2026
oferchen
force-pushed
the
fix/generator-phase-ndx-done
branch
from
November 4, 2026 06:55
c81ad75 to
ef508ee
Compare
oferchen
added a commit
that referenced
this pull request
Nov 4, 2026
oferchen
force-pushed
the
fix/generator-phase-ndx-done
branch
from
November 4, 2026 08:57
3fa239f to
6ccda6f
Compare
oferchen
added a commit
that referenced
this pull request
Nov 10, 2026
oferchen
force-pushed
the
fix/generator-phase-ndx-done
branch
from
November 10, 2026 08:08
7d454a3 to
373ba8e
Compare
oferchen
added a commit
that referenced
this pull request
Nov 10, 2026
oferchen
force-pushed
the
fix/generator-phase-ndx-done
branch
from
November 10, 2026 12:41
373ba8e to
7f3531b
Compare
oferchen
added a commit
that referenced
this pull request
Nov 10, 2026
oferchen
force-pushed
the
fix/generator-phase-ndx-done
branch
from
November 10, 2026 17:45
700a845 to
3970c93
Compare
oferchen
added a commit
that referenced
this pull request
Nov 10, 2026
oferchen
force-pushed
the
fix/generator-phase-ndx-done
branch
from
November 10, 2026 19:07
3970c93 to
05744d0
Compare
Without INC_RECURSE upstream's generator writes the phase-0 NDX_DONE right after its generate loop (generator.c:2831-2833), before any reply is read. The receiver now does the same instead of leaving it to the finalize exchange, reads the sender's answer before the redo pass, and then drains the hard-link follower echoes that now follow it.
open_socket_out() prints one "failed to connect to %s (%s)" line per failed address, naming the host as given and the numeric address, from the process that dialled: the lone Receiver for a pull or a listing, the sender for a push (socket.c:464-475, clientserver.c:164-165). An unresolvable host is "getaddrinfo: HOST PORT: <gai_strerror>" (socket.c:402-406), and a --contimeout expiry exits RERR_CONTIMEOUT before reporting any address. oc printed one line of its own for the last address only, as [client].
…upstream's recv_generator
oferchen
force-pushed
the
fix/generator-phase-ndx-done
branch
from
November 10, 2026 20:35
5243e76 to
b98fc65
Compare
oferchen
added a commit
that referenced
this pull request
Nov 18, 2026
#8434) Two documentation changes for the 0.6.5 release. **Changelog.** Every PR merged since v0.6.4 was checked against `[Unreleased]`. - Seven lines cited five PRs that were closed without merging; they now cite the PRs that carried the work (#8295, #8304, #8314, #8353, #8383). - Three lines added by #8363 were no longer in the file and are restored. - Eighteen merged PRs with user-visible changes had no entry and now have one. - One entry moved from Added to Fixed. **Differences from rsync 3.5.2.** New `docs/differences-from-rsync-3.5.2.md`, linked from the README and the environment reference. It lists behaviour kept on purpose, upstream fixes adopted early (none yet, three pending), oc-rsync extensions (options, transports, daemon parameters, debug words, sandboxing, environment variables, the opt-in consecutive-match extension) and links to the platform documents. Every row is backed by code or a test. No code changes. Closes #8564 Closes #8565
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
Without INC_RECURSE, upstream's generator writes each phase-ending
NDX_DONEas soon as the phase it closes allows. It does not wait for the sender to answer the previous one. oc held every phase end until the sender had echoed the one before, and it also putNDX_DEL_STATSat the wrong point among them.What upstream does (generator.c, rsync 3.5.1 tarball):
NDX_DONEright after the last request, before any reply is read.NDX_DONE(Add parser for legacy rsync daemon greetings #2) goes out right after the redo requests.--delay-updates(EARLY_DELAY_DONE_MSG), the delay phase'sNDX_DONE(Add coverage for duplicate protocol offers in negotiation #3) follows at once.EARLY_DELETE_DONE_MSG) sendsNDX_DEL_STATSand thenNDX_DONEImprove legacy daemon greeting validation #4, so Add coverage for duplicate protocol offers in negotiation #3 precedes the counters.--delay-updates, Add coverage for duplicate protocol offers in negotiation #3 and Improve legacy daemon greeting validation #4 wait until the redo phase has ended (msgdone_cnt > 1).--delete-after,--delete-delay) sendsNDX_DEL_STATSandNDX_DONEafter the delete pass, once the sender's stats are in.None of these writes waits for an echo. The same sequence follows the per-segment
NDX_DONEs under INC_RECURSE.This reverses part of #8112. That change moved
NDX_DEL_STATSoneNDX_DONEearlier, on the reading that upstream sends it ahead of theNDX_DONEthat ends the sender's phase loop. On the wire, 3.5.1 sends #3 before the counters, and a late delete's counters only after the sender's stats. A 3.5.1 server sender then echoes them fromread_final_goodbye()after its stats (rsync.c:336-342).Changes
receiver/transfer/phases.rs: each phase-endingNDX_DONEand theNDX_DEL_STATSframe is gated on the number of sender phaseNDX_DONEs read so far. The plan drives four call sites:exchange_phase_done, in both the INC_RECURSE and the non-INC branch;NDX_DONE.NDX_DEL_STATSecho between the stats and the goodbyeNDX_DONE, where 3.5.1 puts it.Evidence
The comparison used a logging TCP relay between the client and a rsync 3.5.1 tarball daemon, pulling one file with
-r. Each row compares the client's writes and their order relative to the sender'sNDX_DONEs.--delay-updates--delete--delete --delay-updates--delete-after--delete-after --delay-updates--delay-updates--delete --delay-updates--delete--delete-delayBefore this change, measured on the same relay: protocol 31 without INC_RECURSE wrote one
NDX_DONEper sender echo (none,--delay-updates),NDX_DEL_STATSbefore #3 (--delete) and before the sender's stats (--delete-after). INC_RECURSE protocol 31 (none,--delete) also waited for an echo before eachNDX_DONE.For example, at protocol 31 with
--delete, 3.5.1 and oc now both write00 00 ff02 0100000000 00(#2, #3, DEL_STATS, #4) as soon as the sender's phase-0NDX_DONEarrives.Tests
del_stats_order_tests.rsis rewritten around a transcript that interleaves the receiver's writes with its reads of the sender'sNDX_DONEs. It has five cases: early delete, early delete with--delay-updates, late delete, late delete with--delay-updates, and no delete.daemon_pull_request_phase_done.rsgains a replayed-daemon test: after the sender's phase-0NDX_DONE, the client must write the redo and delay phases'NDX_DONEs without further input. Before this change, that read blocks until the socket timeout.block_stats_goodbye.rsnow runs the phase exchange before the goodbye, as the receiver does.daemon_pull_request_phase_done.rsalso gainsredo_phase_ends_right_after_its_request: the replayed daemon sendskeepwith a wrong file checksum and then its phase-0NDX_DONE. The client's redo request must be followed by the redo and delay phases'NDX_DONEs before any redo reply, matching 3.5.1 on the same replay.verify_redo_recovers_network_paths) still pass.Mutations, one per arm, all killed:
NDX_DONEwithout--delay-updates: 3del_stats_ordercells and both replayed-daemon cells fail.NDX_DEL_STATSback before Add coverage for duplicate protocol offers in negotiation #3 (fix: echo NDX_DEL_STATS back from a server sender #8112's slot):early_delete_writes_every_phase_end_after_the_first_sender_donefails.redo_phase_ends_right_after_its_requestfails.Gates:
check_rustfmt_all.py, workspace clippy-D warnings,dead_code_census.py; transfer nextest; test-support transcript and byte-neutrality; core and bin delete, delay-updates, redo, goodbye and phase cells.Not in this PR
0x8000(ITEM_TRANSFER). For a destination that still does not exist, 3.5.1 sends0xa000(ITEM_TRANSFER | ITEM_IS_NEW, generator.c recv_generator()). It's seen on the same replay and filed separately.Folded in: #8303 - report a failed daemon connection in upstream's words and role
When a daemon connection fails, the client now reports each address the way upstream does. Upstream's sources, all verified against 3.5.1:
failed to connect to %s (%s)line per address.getaddrinfo: %s %s: %s.--contimeoutexpiry with code 35 and the trailer only.The role in the report follows upstream:
[Receiver]for a pull or a module listing,[sender]for a push. Three#[ignore]d exit-code tests are replaced byexit_code_10_socket_io::a_refused_daemon_connection_reports_upstreams_lines, which covers pull, push and listing.Gates on the combined tree (merge commit c81ad75):
check_rustfmt_all.py, workspace clippy-D warningsanddead_code_census.pyare clean. Nextest on core, cli and bin (exit_codesplus the connect, getaddrinfo, contimeout and error-report cells): 309 passed. The transfer replay and order cells: 13 passed.Shared files
push-overlap.sh HEAD c03aed7b2reports these overlaps. All touch different functions, apart from the progress-flush branches noted at the end:pipeline.rshunks at 517 and 1445.pipelined.rsat 380 andpipelined_incremental.rsat 477 and 984.core/client/error.rslocal_abort_text.summary.rsat 153.verify_redo_recovers_network_paths.rshelpers.pipeline.rsat 517 and 1445.run_pipeline_loop_decoupled,run_pipelined*) and theReceiverContextfields. I've notified their owner.Folded in: task 591 - redo request item flags
The phase-2 redo now sends the item flags upstream's generator gives it. Before, it always sent a bare
ITEM_TRANSFER.upstream:
recv_generator()for the redo index. That re-stats the destination (generator.c:2213-2223 reports and skips any failure except ENOENT).ITEM_TRANSFER | ITEM_IS_NEW. An existing destination carries its size and time report bits.redo_request_iflags(candidates.rs) stats the destination through the receiver's sandbox, folds--fake-super, reports a non-ENOENT failure with upstream'srecv_generator: failed to statline, and itemizes with the sameitemize_existing_flagsthe first request uses.Evidence: a replayed daemon serves
keepwith a wrong file checksum at protocol 30. The redo request is byte-identical to the 3.5.1 client's in both cases:fe0000 00a0+ empty sum head (before:fe0000 0080)keepwith an older mtime:fe0000 0c80+ sum head with 1 block and a 16-byte strong sumTests in
daemon_pull_request_phase_done.rs:redo_phase_ends_right_after_its_requestnow asserts the full 3.5.1 bytes.redo_request_itemizes_an_existing_destinationasserts0x800c.Mutation: returning a bare
ITEM_TRANSFERmakes both tests fail.Known gap (task 598): with
--delay-updates, and with--partial-dir, 3.5.1 keeps a file that fails verification in the partial dir (receiver.c:1318-1333) and redoes against it. Its request is00a8 81+ a partial-dir basis, where oc sends00a0+ no basis. oc discards the failed file instead.The pull masker anchors on the stats rather than on frame boundaries. The sender flushes before handle_stats() (main.c:1007-1008), so the stats open a MSG_DATA frame, but with master's batched sender flush the goodbye can share that frame (io.c perform_io()). The masker now accepts exactly NDX_DONE, or the NDX_DEL_STATS echo and then NDX_DONE, after the stats.