You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NewClient leaves the SSH session open when it returns an error #669
NewClient opens an SSH session and returns early on several errors without closing it. Each failed call leaves a session channel open on the connection until the connection itself closes.
When the server refuses the sftp subsystem, the error is returned and s stays open.
The same happens if any of the three pipe calls fails.
When newClientPipe fails, for example because an option is rejected or the handshake fails, it closes the session's stdin but not the session.
This shows up in a program that tries SFTP first and falls back to something else when a host has no SFTP subsystem: every attempt on such a host leaves one more open session behind on a long-lived connection.
Possible fix: close the session on every error path in NewClient, including when newClientPipe returns an error, for example:
Activity
puellanivis commentedon Oct 14, 2026
Sounds good. 👍 Would you like to open the PR yourself, so credit is easily marked?
close session when NewClient fails