Skip to content

SshClient.Dispose is throwing exception when SSH session gets disconnected unexpectedely #96

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

Closed
mauroa opened this issue Oct 3, 2016 · 10 comments
Assignees
Labels

Comments

@mauroa
Copy link

mauroa commented Oct 3, 2016

The disposal of an SshClient instance could end throwing an exception when the SSH Session gets disconnected by the remote host.

A quick look into the code shows that even if the Dispose methods calls Disconnect internally and doesn't have exception handling (https://github.com/sshnet/SSH.NET/blob/develop/src/Renci.SshNet/BaseClient.cs#L339) , there is always a null check over the SshSession (https://github.com/sshnet/SSH.NET/blob/develop/src/Renci.SshNet/BaseClient.cs#L225-L246) to prevent any unwanted NullReferenceException. However, something is still going on when the session is remotely disconnected and the SshClient is tried to be disposed after that.

@drieseng drieseng self-assigned this Oct 6, 2016
@drieseng drieseng added the bug label Oct 6, 2016
@drieseng
Copy link
Member

drieseng commented Oct 6, 2016

This should be fixed in the develop branch.
What version of SSH.NET are you using, and can you easily reproduce this issue?
Would it be possible for you to build SSH.NET from source?
If not, I can send you an assembly built from source.
Just let me know which framework you're targeting.

@icnocop
Copy link

icnocop commented Oct 28, 2016

@drieseng , Can we utilize the CI appveyor build so that it automatically publishes the output whenever the code changes so that it can be downloaded and used with less effort?

For example, the build can publish the nuget package to any one of these repositories:

  1. To nuget and indicate that it's a prerelease build (recommended)
  2. To the appveyor project as a build artifact
    Is this already happening? If so, can you provide a link please?
  3. To this github project as a "release", but probably indicate that's it's not "official"

Thank you! :)

@Austneal
Copy link

Is there a workaround for this, or do we still need to build from the development branch?

@drieseng
Copy link
Member

I'm gonna try to ship a new beta this weekend.

@drieseng drieseng added this to the 2016.1.0 milestone Nov 22, 2016
@josephearl
Copy link

Experiencing this issue on 2016.0, a fix would be great 👍

@drieseng
Copy link
Member

This should be fixed in version 2016.1.0-beta1.
Please test and provide feedback.

@josephearl
Copy link

Thanks!

@drieseng
Copy link
Member

@josephearl Can you confirm that this issue is fixed in 2016.1.0-beta1?

@josephearl
Copy link

@drieseng yes works for me

@ogborstad
Copy link

Does this release get out of beta soon?

@drieseng drieseng modified the milestones: 2016.1.0-beta1, 2016.1.0 Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants