Repository navigation
fix(minimal-client): bound the exec ssh handshake so a burst of execs fails instead of hanging - #2016
Conversation
…stead of hanging A burst of `min session exec` commands can leave some execs hung forever in ssh: the ProxyCommand reaches the daemon socket, which accepts even when the guest side never answers, and the exec ssh invocation has no ConnectTimeout or ServerAlive options to bound the connect and handshake. Add `-o ConnectTimeout=<HANDSHAKE_TIMEOUT seconds>` to every invocation, and `-o ServerAliveInterval=15 -o ServerAliveCountMax=4` only for the non-interactive exec path, so a peer that stops answering ends the exec with exit 255 instead of hanging. The interactive path keeps no keepalives so a laptop sleep does not kill the attach.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 5 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughAttach commands now use the shared handshake timeout. Exec channels also receive server-alive options; interactive attaches do not. Tests check the options for both attach modes. ChangesSSH Attach Options
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change bounds hung SSH connects and unresponsive exec sessions without affecting interactive attach. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
A rabbit checks the timeout line Comment |
… handshake bound crate-private
|
/review |
|
@coderabbitai review |
|
Approved: no findings at Nothing to do. Clobber: none: |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
CodeRabbit and minimal-review approved this head; 0 unresolved threads; all lanes green.
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABVYwvFA
A burst of
min session execcommands can leave some execs hung forever inssh: theProxyCommandreaches the daemon socket, which accepts even when the guest side never answers, and the exec ssh invocation has noConnectTimeoutorServerAlive*option to bound the connect and handshake. The RPC client already bounds the same step.attach_commandnow adds-o ConnectTimeout=<HANDSHAKE_TIMEOUT seconds>to every invocation, and-o ServerAliveInterval=15 -o ServerAliveCountMax=4(named constsEXEC_SERVER_ALIVE_INTERVAL_SECS/EXEC_SERVER_ALIVE_COUNT_MAX) only for the non-interactive exec path (wire: Some(_)), so a peer that stops answering ends the exec with exit 255 after about 60 s instead of hanging. A healthy long-running exec answers the keepalives, so the exec's own runtime stays unbounded. The interactive path keeps no keepalives so a laptop sleep does not kill the attach.HANDSHAKE_TIMEOUTis widened topub(crate)soattach.rscan reuse its seconds. The 10 s bound applies after the VM is up (the RPC client already waits out the cold-boot budget and bounds its own handshake by the same constant), so it does not cut into the 150 s cold-boot timeouts.Verification
Manual reproduction of the defect shape (OpenSSH_10.3p1): a ProxyCommand that accepts and never sends a banner, bounded by ConnectTimeout, exits 255 in about 1 s:
cargo fmt --all --check --manifest-path target/Cargo.toml — clean
cargo clippy --workspace --locked --manifest-path target/Cargo.toml -- -D warnings — Finished (0 warnings)
cargo build --workspace --locked --manifest-path target/Cargo.toml — Finished
cargo test --workspace --locked --manifest-path target/Cargo.toml — minimal-client 84 passed; checkouts 2 pre-existing sandbox failures (git-clone, unrelated to this change)
cargo test -p minimal-client attach_command_bounds_the_handshake — 1 passed
Summary by CodeRabbit