Repository navigation
fix(transfer): flush -zz codec state before daemon-sender goodbye (UTS-9.REOPEN) - #5725
Merged
Merged
Conversation
2 tasks
oferchen
added a commit
that referenced
this pull request
Jun 12, 2026
* chore: fix master fmt drift + filter_map_bool_then clippy lint
Master CI broke on rustfmt 1.88 and clippy 1.88:
1. `crates/cli/src/frontend/server/run.rs:244` - `use fast_io::landlock::{...}`
collapses to a single line under rustfmt 1.88 (introduced by PR #5724's
landlock wire-in).
2. `crates/transfer/src/generator/filters.rs:589` - `let split = ...` long-form
collapses to single-line under rustfmt 1.88.
3. `crates/transfer/src/generator/file_list/mod.rs:267` - rewrite
`filter_map(|(b, rel)| (b == &entry.base).then(|| rel.clone()))` as the
equivalent `filter(...).map(...)` pair so clippy 1.88's new
`filter_map_bool_then` lint stays clean. Behaviour-identical.
Unblocks PRs #5725, #5726, #5727 once they rebase onto this.
* fix: drop extraneous deref in filter predicate
In .filter(), the destructured 'b' is already &PathBuf since iter() yields
&(PathBuf, PathBuf) and filter receives &Self::Item. The extra deref made it
PathBuf, causing E0277 'can't compare PathBuf with &PathBuf'.
* chore(cli): inline format args in --partial-dir test (clippy 1.88)
uninlined_format_args lint denies the build under clippy 1.88.
…S-9.REOPEN) The previous UTS-9.REOPEN landing called `ServerWriter::finalize_compression()` after `handle_goodbye` returned, but under `-zz` daemon pull `handle_goodbye` never returns: the sender blocks on the receiver's final NDX_DONE while the receiver blocks on an unterminated deflate block held in our `CompressedWriter` buffer. The receiver surfaces this as "connection unexpectedly closed (N bytes received so far) [receiver]" once the daemon times out and FINs. Mirror upstream's `main.c:979-983 do_server_sender()` flush-bracketing of `read_final_goodbye()` by introducing `handle_goodbye_with_finalizer`, which runs a caller-supplied hook between the goodbye write+flush and the goodbye read. The generator orchestrator passes `|w| w.finalize_compression()` so the deflate end-of-stream trailer ships before the receiver is asked to decompress past the closing block. Upstream's NDX_DONE rides through `io.c:2255 write_buf()` (uncompressed); our writer-graph routes it through `CompressedWriter`, so we additionally need `token.c:367 send_deflated_token()`'s end-of-transfer `deflateEnd()` contract honoured here. A regression test in the generator unit-test module asserts the new ordering invariant: the finalizer must observe the goodbye NDX_DONE in the wire buffer (write side complete) AND must run before the final receiver NDX_DONE is consumed (read side not yet started). Without this, the prior fix's post-goodbye finalisation is unreachable. UTS-9.REOPEN.4 / UTS-15.c (legacy `handle_goodbye` flush-before-close contract) are preserved: the non-finalizer variant delegates with a no-op hook, and the existing FlushTrackingWriter test still asserts `last_op_was_flush`. IUS-4 / SZC SEND_ZC behaviour is unaffected (no changes to data-phase send paths).
The handle_goodbye wrapper is only invoked from generator tests; production orchestrator calls handle_goodbye_with_finalizer directly. Under --features async the unused-method lint denies the build.
oferchen
force-pushed
the
fix/uts9-reopen-zz-goodbye-flush
branch
from
June 12, 2026 01:40
1e0a7db to
e8299ca
Compare
This was referenced Jun 12, 2026
oferchen
added a commit
that referenced
this pull request
Jun 19, 2026
Adds the cross-binary upstream-compat harness primitives specified by NXT-1 (`UpstreamVersion`, `locate_upstream_rsync`, `require_upstream_rsync`, `upstream_compat_enabled`) and ports the upstream `daemon-gzip-download.test` goodbye-flush invariant into nextest. The test pairs an upstream rsync 3.4.4 client against an oc-rsync daemon over TCP and pulls a ~1 MB `-zz`-compressed fixture sized to clear the UTS-9 ~615 KB cutoff. The invariant pinned is that the daemon-sender goodbye envelope reaches the upstream client without a premature connection drop - the regression family fixed by PRs #5520 / #5600 / #5619 / #5725. Self-skips on three conditions: `OC_RSYNC_UPSTREAM_COMPAT` env var unset (default for PR cells), upstream rsync 3.4.4 binary not present at `target/interop/upstream-install/3.4.4/bin/rsync`, or the oc-rsync binary cannot be located. Wall-time impact on the standard PR cell is a single early-return. NXT-1 calls out that the new `upstream-compat` CI cell is the wire-up step that flips the env var on. That cell does not exist yet; this PR ships the test and harness only, and a follow-up will add the matrix entry to the existing nextest workflow. Refs: docs/design/nxt-1-nextest-harness.md
oferchen
added a commit
that referenced
this pull request
Jun 19, 2026
…6002) Adds the cross-binary upstream-compat harness primitives specified by NXT-1 (`UpstreamVersion`, `locate_upstream_rsync`, `require_upstream_rsync`, `upstream_compat_enabled`) and ports the upstream `daemon-gzip-download.test` goodbye-flush invariant into nextest. The test pairs an upstream rsync 3.4.4 client against an oc-rsync daemon over TCP and pulls a ~1 MB `-zz`-compressed fixture sized to clear the UTS-9 ~615 KB cutoff. The invariant pinned is that the daemon-sender goodbye envelope reaches the upstream client without a premature connection drop - the regression family fixed by PRs #5520 / #5600 / #5619 / #5725. Self-skips on three conditions: `OC_RSYNC_UPSTREAM_COMPAT` env var unset (default for PR cells), upstream rsync 3.4.4 binary not present at `target/interop/upstream-install/3.4.4/bin/rsync`, or the oc-rsync binary cannot be located. Wall-time impact on the standard PR cell is a single early-return. NXT-1 calls out that the new `upstream-compat` CI cell is the wire-up step that flips the env var on. That cell does not exist yet; this PR ships the test and harness only, and a follow-up will add the matrix entry to the existing nextest workflow. Refs: docs/design/nxt-1-nextest-harness.md
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
* chore: fix master fmt drift + filter_map_bool_then clippy lint
Master CI broke on rustfmt 1.88 and clippy 1.88:
1. `crates/cli/src/frontend/server/run.rs:244` - `use fast_io::landlock::{...}`
collapses to a single line under rustfmt 1.88 (introduced by PR #5724's
landlock wire-in).
2. `crates/transfer/src/generator/filters.rs:589` - `let split = ...` long-form
collapses to single-line under rustfmt 1.88.
3. `crates/transfer/src/generator/file_list/mod.rs:267` - rewrite
`filter_map(|(b, rel)| (b == &entry.base).then(|| rel.clone()))` as the
equivalent `filter(...).map(...)` pair so clippy 1.88's new
`filter_map_bool_then` lint stays clean. Behaviour-identical.
Unblocks PRs #5725, #5726, #5727 once they rebase onto this.
* fix: drop extraneous deref in filter predicate
In .filter(), the destructured 'b' is already &PathBuf since iter() yields
&(PathBuf, PathBuf) and filter receives &Self::Item. The extra deref made it
PathBuf, causing E0277 'can't compare PathBuf with &PathBuf'.
* chore(cli): inline format args in --partial-dir test (clippy 1.88)
uninlined_format_args lint denies the build under clippy 1.88.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…S-9.REOPEN) (#5725) * fix(transfer): flush -zz codec state before daemon-sender goodbye (UTS-9.REOPEN) The previous UTS-9.REOPEN landing called `ServerWriter::finalize_compression()` after `handle_goodbye` returned, but under `-zz` daemon pull `handle_goodbye` never returns: the sender blocks on the receiver's final NDX_DONE while the receiver blocks on an unterminated deflate block held in our `CompressedWriter` buffer. The receiver surfaces this as "connection unexpectedly closed (N bytes received so far) [receiver]" once the daemon times out and FINs. Mirror upstream's `main.c:979-983 do_server_sender()` flush-bracketing of `read_final_goodbye()` by introducing `handle_goodbye_with_finalizer`, which runs a caller-supplied hook between the goodbye write+flush and the goodbye read. The generator orchestrator passes `|w| w.finalize_compression()` so the deflate end-of-stream trailer ships before the receiver is asked to decompress past the closing block. Upstream's NDX_DONE rides through `io.c:2255 write_buf()` (uncompressed); our writer-graph routes it through `CompressedWriter`, so we additionally need `token.c:367 send_deflated_token()`'s end-of-transfer `deflateEnd()` contract honoured here. A regression test in the generator unit-test module asserts the new ordering invariant: the finalizer must observe the goodbye NDX_DONE in the wire buffer (write side complete) AND must run before the final receiver NDX_DONE is consumed (read side not yet started). Without this, the prior fix's post-goodbye finalisation is unreachable. UTS-9.REOPEN.4 / UTS-15.c (legacy `handle_goodbye` flush-before-close contract) are preserved: the non-finalizer variant delegates with a no-op hook, and the existing FlushTrackingWriter test still asserts `last_op_was_flush`. IUS-4 / SZC SEND_ZC behaviour is unaffected (no changes to data-phase send paths). * fix(transfer): gate test-only handle_goodbye wrapper under cfg(test) The handle_goodbye wrapper is only invoked from generator tests; production orchestrator calls handle_goodbye_with_finalizer directly. Under --features async the unused-method lint denies the build.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…6002) Adds the cross-binary upstream-compat harness primitives specified by NXT-1 (`UpstreamVersion`, `locate_upstream_rsync`, `require_upstream_rsync`, `upstream_compat_enabled`) and ports the upstream `daemon-gzip-download.test` goodbye-flush invariant into nextest. The test pairs an upstream rsync 3.4.4 client against an oc-rsync daemon over TCP and pulls a ~1 MB `-zz`-compressed fixture sized to clear the UTS-9 ~615 KB cutoff. The invariant pinned is that the daemon-sender goodbye envelope reaches the upstream client without a premature connection drop - the regression family fixed by PRs #5520 / #5600 / #5619 / #5725. Self-skips on three conditions: `OC_RSYNC_UPSTREAM_COMPAT` env var unset (default for PR cells), upstream rsync 3.4.4 binary not present at `target/interop/upstream-install/3.4.4/bin/rsync`, or the oc-rsync binary cannot be located. Wall-time impact on the standard PR cell is a single early-return. NXT-1 calls out that the new `upstream-compat` CI cell is the wire-up step that flips the env var on. That cell does not exist yet; this PR ships the test and harness only, and a follow-up will add the matrix entry to the existing nextest workflow. Refs: docs/design/nxt-1-nextest-harness.md
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
ServerWriter::finalize_compression()AFTERhandle_goodbyereturned, but under-zzdaemon pullhandle_goodbyedeadlocks: the sender blocks on the receiver's finalNDX_DONEwhile the receiver blocks on an unterminated deflate block held in ourCompressedWriterbuffer. The receiver surfaces this as"connection unexpectedly closed (612423 bytes received so far) [receiver]"once the daemon times out and FINs - the same shape asUTS-9.REOPEN.4/UTS-15.c, but on the compressed daemon-pull path.main.c:979-983 do_server_sender()flush-bracketing ofread_final_goodbye()by introducinghandle_goodbye_with_finalizer. It runs a caller-supplied hook BETWEEN the goodbye write+flush and the goodbye read. The generator orchestrator passes|w| w.finalize_compression()so the deflate end-of-stream trailer ships before the receiver is asked to decompress past the closing block (matchingtoken.c:367 send_deflated_token()'s end-of-transferdeflateEnd()contract). Upstream'sNDX_DONErides throughio.c:2255 write_buf()uncompressed; our writer-graph routes it throughCompressedWriter, so we additionally need to drive the codec finalisation here.NDX_DONEalready in the wire buffer AND must run before the final receiverNDX_DONEis consumed. Without this, the prior fix's post-goodbye finalisation is unreachable.What this preserves
UTS-9.REOPEN.4/UTS-15.c: the legacyhandle_goodbyeflush-before-close contract is preserved. The non-finalizer variant delegates with a no-op hook, and the existinghandle_goodbye_proto31_flushes_ndx_done_before_closeFlushTrackingWritertest still assertslast_op_was_flushand trailingNDX_DONEbytes.IUS-4/SZC SEND_ZC: no changes to data-phase send paths or zero-copy dispatch.finalize_compression()call after the goodbye still runs (idempotent onMultiplex, degrades to a plain flush) so trailingMSG_INFOframes still ship before FIN.Test plan
handle_goodbye_with_finalizer_runs_between_write_and_readregression test incrates/transfer/src/generator/tests.rspins the write-then-finalize-then-read ordering using aTrackingReader+ thread-local byte counter.server_writer_finalize_compression_*tests incrates/transfer/src/writer/tests.rsstill cover zlib end-of-stream decode round-trip on the receiver side.handle_goodbye_proto31_flushes_ndx_done_before_closetest still passes through the no-op-finalizer delegate (handle_goodbye->handle_goodbye_with_finalizer(...|_w| Ok(()))).daemon-gzip-downloadupstream interop case.