GeezerVison is showing github.com — fleet-proxy(stdio): relay never exits after remote close while stdin stays open — up.join() waits on a stdin-blocked thread · Issue #5518 · developing-today/code
fleet-proxy(stdio): relay never exits after remote close while stdin stays open — up.join() waits on a stdin-blocked thread #5518DescriptionBug: fleet proxy connect --stdio never exits after the remote side closes, when stdin stays open
pkgs/fleet/crates/fleet-proxy/src/stdio.rs, relay_stdio (merged in step 3, PR #5515):
let up = std::thread::spawn(move || {
let mut stdin = std::io::stdin().lock();
pump(&mut stdin, &mut inbound);
let _ = inbound.shutdown(std::net::Shutdown::Write);
});
// tunnel → stdout on this thread.
let mut stdout = std::io::stdout().lock();
pump(&mut tunnel, &mut stdout);
drop(tunnel);
let _ = up.join(); // <-- blocks until stdin reaches EOF
Ok(0)
When the tunnel side closes first (server closes / SSH session ends), the
download pump returns — but up.join() then waits for the upload thread,
which is blocked in stdin.read() and also holds the try_clone() of the
socket, so drop(tunnel) closes nothing. The process hangs until stdin
also reaches EOF. As an SSH ProxyCommand this wedges session teardown:
the remote is gone, the bytes are delivered, and the relay process never
exits.
Verified this run (laptop probe, real crate @ main 5521f3f)
Probe crate ~/git/fleet/probe-stdio-hang (path-dep on the real
fleet-proxy, default-features = false) calling
relay_stdio in direct mode against a loopback server that sends
hello-from-server\n and closes:
- Case A — stdin held open (pipe write-end open, no data, no EOF):
stdout received hello-from-server, then the process hung;
timeout 6 killed it (exit 124).
- Case B — control, stdin at EOF (
< /dev/null): exit 0 promptly,
same bytes delivered.
Why it matters
--stdio exists to be SSH's ProxyCommand. A ProxyCommand that outlives
the connection leaks a process per dead session and can stall ssh
exit; the Python relay it replaces exits when either side is done.
Acceptance criteria
- When the tunnel reaches EOF/errors,
relay_stdio returns promptly
even if stdin is still open with no data.
- The stdin-EOF-first half-close behavior is preserved: stdin EOF
still shutdown(Write)s the tunnel and the download side drains
until the remote closes.
- Probe case A above exits 0 within ~1s of the server closing;
case B unchanged.
-
cargo test -p fleet-proxy green.
Activitydeveloping-today commented on Nov 4, 2026 dezren39 commented on Nov 4, 2026 🤖 Agent note · filed
- Agent: new-issue-creator job (new-issue-creator-code-b, Lane B)
- Session / ID: cron new-issue-creator-code-b, 2026-11-04 08:50 CST run
- Found via: filed this run
- Task: Filed after verifying behaviorally with a probe crate against the real
fleet-proxy crate on the laptop (probe ~/git/fleet/probe-stdio-hang @ main 5521f3f): with the tunnel closed by the server and stdin held open, relay_stdio hangs (timeout-killed at 6s) because it joins an upload thread blocked in stdin.read(); the stdin-EOF control exits 0 promptly.
- Expectation: effort xs — guarded self-solve this run: stop joining the stdin-blocked upload thread when the download side ends in
relay_stdio (pkgs/fleet/crates/fleet-proxy/src/stdio.rs), preserving the stdin-EOF half-close; re-probe both cases + cargo test -p fleet-proxy, PR + merge when green.
- Links: branch
creator-b/5518-stdio-relay-exit (to come)
dezren39 commented on Nov 4, 2026 🤖 Agent note · done
- Agent: new-issue-creator job (new-issue-creator-code-b, Lane B)
- Session / ID: cron new-issue-creator-code-b, 2026-11-04 08:50 CST run
- Found via: filed this run
- Task: Guarded self-solve complete — PR fix(fleet-proxy): stdio relay exits when the tunnel closes (#5518) #5520 squash-merged (4fb0927):
relay_stdio no longer joins the stdin-blocked upload thread after the tunnel side ends; it shuts the socket down and detaches the thread, so the relay exits when either side is done. The stdin-EOF half-close path is unchanged.
- Expectation: done —
cargo test -p fleet-proxy --all-features green on the laptop (8 passed), fmt applied, single-file diff (+10/−1); fixed crate re-probed (probe ~/git/fleet/probe-stdio-fixed): remote-close + stdin-held-open now exits 0 in 17 ms (was a hang, timeout-killed at 6 s pre-fix), and the half-close control (stdin EOF first, server replies after) still delivers echo:ping, exit 0.
- Links: PR fix(fleet-proxy): stdio relay exits when the tunnel closes (#5518) #5520 (merged), branch
creator-b/5518-stdio-relay-exit (deleted on merge)
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|