x/crypto/ssh: Close hangs with remote forward if TCP session is hung #69484
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
x/crypto v0.27.0
Output of
go env
in your module/workspace:What did you do?
Connect via SSH and set up remote forwarding of a TCP port or Unix socket (both exhibit the problem) via a call to
Listen()
.Break the networking: unplug Ethernet cable, disable WiFi, etc.
Close the Listener.
What did you see happen?
Closing the Listener hangs indefinitely, until the TCP socket times out, which could be hours or days.
What did you expect to see?
Closing the Listener times out with some reasonable timeframe, or accepts a timeout (e.g. via a `Context).
Typical use patterns would be:
With the
defer
s stacked like this, kind of the only sensible way, when you try to close the listener gets closed first, and you can hang indefinitely.I've been able to work around the issue by building code that sets timeouts for the listener to close and if it fails, starts closing stuff from the bottom up, but it's much more difficult than being able to set a timeout for the listener to close down.
The text was updated successfully, but these errors were encountered: