-
Notifications
You must be signed in to change notification settings - Fork 674
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
POSIX client can't disconnect from version 1.x.x SFTP server #1029
Comments
You're using |
@mscdex No, |
@mscdex Hiya, any idea what could be causing the issue? I'd be happy to look into it and even submit a PR, but I'm at a loss of where exactly to start looking. |
I don't know offhand, AFAICT from the code it should be at least emitting |
Here's a workaround that seems to work for me: session.on('close', () => {
client.end();
});
session.on('end', () => {
client.end();
}); Some clients trigger the first, some the second. |
@sedenardi Can you verify #1111 fixes the problem for you? |
had this problem on Mac sftp session.on('close', () => { fixed my problem |
Apologies for the long delay, I completely missed your reply. Adding a listener for session.on('end', () => {
client.end();
}); Adding a listener for |
Description
When using a macOS or Linux client to connect to an SFTP server created using
ssh2
, the typical way to disconnect from the server is using thequit
(orexit
orbye
) command. When the server uses the latest version of this library,1.1.0
, the client hangs after issuing the command (the program is never closed). Additionally, theend
Connection event is never fired on the server.When using versions of
ssh2
prior to1.x.x
, issuing theexit
command on the client exits the program and fires theend
Connection event on the server.Versions
Server: macOS 11.4, node v14.15.0
Tested clients: macOS 11.4, CentOS Linux 7
Tested library versions:
0.8.9
(pass),1.0.0
(fail),1.1.0
(fail)Sample Code
These are arbitrary server implementations, based on the examples for each version's
README
, that support a posix client only connecting and then disconnecting. The client issues acwd
upon connecting, soREALPATH
is the only server event implemented. For both, the following commands were run on both macOS and CentOS:1.1.0
- FailingOutput:
server listening on port 2222 client connected client ready session sftp sftp REALPATH .
0.8.9
- PassingOutput:
server listening on port 2222 client connected client ready session sftp sftp REALPATH . client end
The text was updated successfully, but these errors were encountered: