Skip to content
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

client: fix hang on ssh.Dial() on reboot #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Feb 7, 2023

  1. client: fix hang on ssh.Dial() on reboot

    This commit adds a thin wrapper around the real ssh.Dial() that
    additionally sets a deadline on the underlying connection.
    
    It is needed because a ssh.Dial() can happens right after the
    reboot command is issued. The net.Dial() itself is successful but
    then then during the ssh session setup the TCP connection ends
    because of the reboot. The golang "ssh" package has no concpt of
    "ssh -o ServerAliveInterval=10" or simialr so the code will
    just hang in a read forever. This was observed running the
    spread "cerberus" tests on ubuntu 23.04.
    
    Note that half of the function is just a copy of
    golang.org/x/crypto/ssh/client.go:func Dial()
    and only the conn.SetDeadline() bits are new.
    
    See also e.g. golang/go#51926 for
    various bugreports about the golang "ssh" package and hangs.
    mvo5 committed Feb 7, 2023
    Configuration menu
    Copy the full SHA
    93c16ab View commit details
    Browse the repository at this point in the history