x/crypto/ssh: timeout needed when requesting session with PTY #36227
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am doing two things:
My server does not provide PTYs and ignores requests for them, only responding to "shell".
I was attempting to use goexpect with goexpect.SpawnSSH() to interact with my fake SSH server, which is pretending to be a router from a vendor.
goexpect.SpawnSSH() calls the ssh.Session.RequestPty()
That in turn calls: s.ch.SendRequest()
Which is a private "channel" type in channel.go that implements Channel, which has a .SendRequest() method
In channel.go around line 594 there is a statement:
m, ok := (<-ch.msg)
This doesn't return.
So what happens is that the client locks up without any indication of what is going on.
I don't know the best way to handle this (context for RequestPty() (probably too late) ) or just a timeout waiting for this based on some value like 30 * time.Second.
An example is included here:
https://play.golang.org/p/jLTIkNRWjLH
What did you expect to see?
Some type of error if the PTY could not be granted. Clients should not break because the server is broken.
What did you see instead?
The program blocks forever, no indication of what is going on.
The text was updated successfully, but these errors were encountered: