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

fix "client not connected" after SFTP reconnect #1484

Merged
merged 2 commits into from
Sep 6, 2024

Conversation

mus65
Copy link
Contributor

@mus65 mus65 commented Sep 5, 2024

if the server closes the session and the client reconnects, this currently leads to a broken state because the session is re-created, but the SFTP subsession is not and still references the old session.

This causes all operations to fail with "client not connected" or even throwing the "An established connection was aborted by the server." exception of the old session.

Always re-create the SFTP subsession to fix this.

Also noticed another issue while looking into this: if the session already exists, but it not connected anymore, the old instance was never disposed.

fixes #1474

if the server closes the session and the client reconnects,
this currently leads to a broken state because the session
is re-created, but the SFTP subsession is not and still
references the old session.

This causes all operations to fail with "client not connected" or
even throwing the "An established connection was aborted by the server."
exception of the old session.

Always re-create the SFTP subsession to fix this.

fixes sshnet#1474
@mus65 mus65 force-pushed the clientnotconnected branch from 4435763 to 5777f01 Compare September 5, 2024 18:05
@WojciechNagorski
Copy link
Collaborator

image

@Rob-Hague
Copy link
Collaborator

I think those are unrelated. I can take a closer look later

@mus65
Copy link
Contributor Author

mus65 commented Sep 6, 2024

Tests all pass locally on linux, so probably unrelated.

@Rob-Hague Rob-Hague merged commit 6669309 into sshnet:develop Sep 6, 2024
1 check passed
@Rob-Hague
Copy link
Collaborator

Does it fix #1474 (comment) as well?

@mus65
Copy link
Contributor Author

mus65 commented Sep 6, 2024

yes, this is also caused by the SFTP subsession referencing the old session object (and therefore re-throwing its old exception).

@mus65 mus65 deleted the clientnotconnected branch September 14, 2024 09:30
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

Successfully merging this pull request may close these issues.

SFTP: "client not connected" after server closed connection
3 participants