You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A forwarded TCP connection never signals end-of-stream to the caller #88
A caller that reads a forwarded TCP connection to end-of-stream never gets it. The sandbox side closes its socket; the caller's channel stays open with no data and no end.
Proof
A node server in a docker-sbx sandbox, createServer(s => s.end(Buffer.alloc(N, 97))), read from the caller through the gateway's direct-tcpip forward with asyncssh, reader.read(65536) in a loop until an empty read, with a timeout per read:
size=200000 got=200000 OK end=silence 10.3s
size=1000000 got=1000000 OK end=silence 10.1s
size=3000000 got=3000000 OK end=silence 10.1s
size=8000000 got=8000000 OK end=silence 15.4s
size=16000000 got=16000000 OK end=silence 15.3s
Every byte arrives. The end never does: each read after the last byte waits until the timeout.
Why it matters
A client protocol that ends with the server's close, HTTP/1.0 style or "send everything and close", hangs through the gateway. The chat bridge in druks works because it ends its answers with a newline, and a bug in its reader was only found because of that (linked below).
Where to look
The forward relay in src/gateway/server.py: when the tunnel side reports end-of-data for a forwarded connection, the caller's channel should get write_eof, and a close on the caller side should close the tunnel side. sandboxd logs ssh: port forward closed with non-zero relay exit on every forward close, which may be the same half-close.
The cause is in sandboxd, not in the gateway relay.
A probe without drukbox (asyncssh through sbx ssh proxy, direct-tcpip to a node server in the sandbox that sends 200000 bytes and closes):
Caller sends no EOF: all bytes arrive, then no EOF and no channel close. The channel stays open until the caller's timeout.
Caller sends EOF: the channel closes at once, again with no EOF first.
So sandboxd closes the forward only when both sides have half-closed, and never forwards the sandbox server's close. The gateway gets no signal to pass on. A test with an asyncssh sandboxd shows the relay already passes both an EOF and a close to the caller.
Decision: no drukbox change. This goes to Docker as a sandboxd bug; this issue stays open until sbx ships a fix.
Activity
czpython commentedon Oct 27, 2026
Found through czpython/druks#1021.
czpython commentedon Nov 2, 2026
The cause is in sandboxd, not in the gateway relay.
A probe without drukbox (asyncssh through
sbx ssh proxy, direct-tcpip to a node server in the sandbox that sends 200000 bytes and closes):So sandboxd closes the forward only when both sides have half-closed, and never forwards the sandbox server's close. The gateway gets no signal to pass on. A test with an asyncssh sandboxd shows the relay already passes both an EOF and a close to the caller.
Decision: no drukbox change. This goes to Docker as a sandboxd bug; this issue stays open until sbx ships a fix.
Generated by Claude Code
czpython commentedon Nov 2, 2026
Upstream: docker/sbx-releases#803
Generated by Claude Code