Repository navigation
feat(rsync_io): bounded timeout on SSH goodbye phase (SSR-4) - #4820
Merged
Merged
Conversation
oferchen
force-pushed
the
feat/ssr-4-ssh-goodbye-timeout-guard
branch
from
May 23, 2026 20:32
f16f273 to
571c8cf
Compare
oferchen
force-pushed
the
feat/ssr-4-ssh-goodbye-timeout-guard
branch
3 times, most recently
from
May 23, 2026 20:55
9484ee2 to
6e2533d
Compare
Guards the russh-driven SSH session-shutdown path with a 30-second bounded budget so a deadlocked remote channel close surfaces as a typed `SshError::GoodbyePhaseTimeout` rather than as a multi-minute hang. Anchors against the v0.6.1 SSH push regression (200x slowdown vs upstream) that was fixed in PR #4154. - Adds `SSH_GOODBYE_TIMEOUT = 30 s` constant with rationale. - Extends `SshError` with `GoodbyePhaseTimeout { elapsed }`. - Adds `ChannelReader::wait_for_eof_with_timeout` using `recv_timeout` with a wall-clock deadline. - Wires the bounded wait into `embedded_ssh_transfer.rs` after the writer drop. The goodbye guard only fires on otherwise-successful transfers so it never masks a more informative transfer error. - Maps a timeout to `ExitCode::Timeout` (30, RERR_TIMEOUT). - Three deterministic unit tests using budget-as-upper-bound rather than wall-clock equality.
oferchen
force-pushed
the
feat/ssr-4-ssh-goodbye-timeout-guard
branch
from
May 23, 2026 21:30
6e2533d to
9dc91a8
Compare
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
Guards the russh-driven SSH session-shutdown path with a 30-second bounded budget so a deadlocked remote channel close surfaces as a typed `SshError::GoodbyePhaseTimeout` rather than as a multi-minute hang. Anchors against the v0.6.1 SSH push regression (200x slowdown vs upstream) that was fixed in PR #4154. - Adds `SSH_GOODBYE_TIMEOUT = 30 s` constant with rationale. - Extends `SshError` with `GoodbyePhaseTimeout { elapsed }`. - Adds `ChannelReader::wait_for_eof_with_timeout` using `recv_timeout` with a wall-clock deadline. - Wires the bounded wait into `embedded_ssh_transfer.rs` after the writer drop. The goodbye guard only fires on otherwise-successful transfers so it never masks a more informative transfer error. - Maps a timeout to `ExitCode::Timeout` (30, RERR_TIMEOUT). - Three deterministic unit tests using budget-as-upper-bound rather than wall-clock equality.
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
SshError::GoodbyePhaseTimeoutrather than as a multi-minute hang.docs/ssh-transport-decision-matrix.md.ExitCode::Timeout(30, RERR_TIMEOUT).What changed
SSH_GOODBYE_TIMEOUT: Duration = 30 sconstant inrsync_io::ssh::embedded::connect, with rustdoc explaining the lower/upper bound tradeoff (too small = spurious shutdown errors on slow networks; too large = deadlocks again present as wall-clock cliffs).SshError::GoodbyePhaseTimeout { elapsed }variant.ChannelReader::wait_for_eof_with_timeout(budget)helper usingstd::sync::mpsc::recv_timeoutwith anInstant-based deadline so a stream of late chunks before a stall still surfaces a timeout within the budget.crates/core/src/client/remote/embedded_ssh_transfer.rscalls the bounded wait immediately afterdrop(writer). The goodbye guard only fires on otherwise-successful transfers so it never masks a transfer-level diagnostic.Why this is the SSR-4 shape
The v0.6.1 regression (anchored in
docs/ssh-transport-decision-matrix.mdsection 5) hit the subprocess SSH wrapper. v0.6.2 fixed it by switching the russh path to be the preferred SSH transport. SSR-4 hardens that preferred path with a budget guard so a future deadlock inrussh::Channel::wait()(or in the bridge task that drains it) surfaces in seconds as a typed error mapped to a sensible upstream exit code, not as a 200x throughput cliff.Test plan
wait_for_eof_times_out_when_bridge_stalls- holds the bridge sender open and assertsGoodbyePhaseTimeoutfires within a generous upper bound (2 s) for a 50 ms budget.wait_for_eof_returns_ok_on_clean_drop- dropping the sender (healthy goodbye) returnsOk(())promptly.wait_for_eof_drains_pending_chunks_then_times_out- chunks delivered before a stall are discarded; the budget still trips when the sender stays alive.Tests use the budget as an upper bound rather than wall-clock equality so they stay deterministic under scheduling jitter.