-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Propagate sshforward send side connection close #3506
Propagate sshforward send side connection close #3506
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sending this @aaronlehmann, I just verified the original problem in dagger is still gone when running with this change, so we should be all good.
I did realize after my original suggestion that there's probably a slightly preferable change:
if conn, ok := conn.(interface {
CloseWrite() error
}); ok {
conn.CloseWrite()
}
Just because this is a public interface and callers could thus provide something besides a UnixConn
technically. I tested that too and verified it still works for dagger.
Approving anyways because that's pretty obscure, don't care if we merge as is if you don't have time to test again before the v0.11.1 patch release comes out.
PR moby#3431 caused connections closed on the remote side of a sshforward session to not always result in the local side reading an EOF from the connection. This change restores that behavior by closing the write side of the forwarded connection after reading an EOF from the stream. Since only the write side is being closed, it doesn't prevent the remote side from continuing to read from the connection. Signed-off-by: Aaron Lehmann <[email protected]>
156fd65
to
8c978cf
Compare
Updated to your new suggestion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand how this works. Afaics conn
is always type *sock
that is internal wrapper and never implements CloseWrite
.
@tonistiigi: It seems like that wrapping only applies for SSH agent forwarding in buildkit/session/sshforward/ssh.go Line 51 in c521afd
|
PR #3431 caused connections closed on the remote side of a sshforward session to not always result in the local side reading an EOF from the connection. This change restores that behavior by closing the write side of the forwarded connection after reading an EOF from the stream. Since only the write side is being closed, it doesn't prevent the remote side from continuing to read from the connection.