melbahja/goph

SSH NewSession Can Hang Indefinitely

amcrn opened this issue · 2 comments

amcrn commented

See golang/go#26643

The relevant fix can be seen here: https://github.com/cybozu-go/cke/pull/81/files

I hit this using the latest goph client on a remote machine with a badly behaving SSH Server.

Workaround is to timeout the channel in which the goph calls are being executed.

    select {
    case result := <- someChannel:
        fmt.Println(result)
    case <- time.After(timeout * time.Second):
        fmt.Println("ssh new session was hung")
    }

Hi,
I will see how we can fix it, thanks for useful info.

you can use cmd with context fixed in #24, released in v1.3.0