Skip to content
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

Piping sftp readStream to sftp writeStream - no error when client disconnects #127

Open
jeffrson opened this issue Mar 25, 2019 · 3 comments

Comments

@jeffrson
Copy link

jeffrson commented Mar 25, 2019

Hi,
I'm copying files via sftp from one server to another simply by piping a readStream to writeStream.
Actually I'm using ssh2-promise, but afaict, it simply wraps ssh2-streams methods.

Unfortunately, it seems copying hangs forever, when (say) the destination server disappears. Debug output says

DEBUG: Outgoing: Writing CHANNEL_CLOSE (0)
and later
DEBUG: Outgoing: Writing REQUEST_FAILURE

every 15 seconds. When the source server disappears instead, I don't see a channel close, but outgoing write fails with the same DEBUG message.

Furthermore, when I want to cancel a copy task, closing ssh2 connection does not seem to stop/error the streams.

How should I handle these cases?

@jeffrson
Copy link
Author

Well, nevertheless it might be an ssh2-promise issue (see linked issue).

@jeffrson
Copy link
Author

Hmmm - is it a bug, that not the readStream emits the error, but SSH2.Client?

@mscdex
Copy link
Owner

mscdex commented Mar 26, 2019

If there are outstanding requests for an sftp session when it's cleaned up, errors are passed to the requests' callbacks, which should in turn emit errors on the stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants