-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/crypto/ssh: add support for alive interval #19338
Comments
\cc @hanwen |
you can trivially do this yourself by sending a message in a loop on a timer. |
I have a case where I do not have access to the connection, since the hang happened during Dial:
|
This could solve it for the Dial case:
|
As i see this one is stale for few years already. Does it mean you people found some another solution to this problem? If you have one please share with us. Very much interested. |
For my part, I implented a work-around by wrapping the fix from my comment above into a new |
When the underlying TCP connection for a long-standing SSH connection abruptly dies, operations on an
ssh.Client
can hang forever. This is because the client remains stuck in anio.ReadFull
call with no preceding or concurrent calls tonet.Conn.SetDeadline
. Without any deadline set, there is no guarantee thatRead
will ever return.Even though the user has access the underlying
net.Conn
and can set the deadline themselves, they have no way of determining if the underlying connection is actually dead or just idle. Thus, thessh
package should support this functionality that allows sending of empty messages to intentionally invoke a response from the remote endpoint, in order to determine if it is still alive.This is a feature request for the equivalent options for OpenSSH:
AliveInterval time.Duration
: Sets a timeout interval after which, if no data has been received, sends an alive message through the encrypted channel to invoke a response from the remote end. The default is 0, indicating that such messages will not be sent.AliveCountMax int
: Sets the number of alive messages which may be sent without receiving a response from the remote end. If this threshold is reached while alive messages are being sent, the SSH session will be terminated.If this is reasonable, I can implement this.
The text was updated successfully, but these errors were encountered: