Skip to content

Information provided by remote host is not captured when channel session is rejected #305

@gordonwatts

Description

@gordonwatts

I've got an intermittent crash I'd like to track down a bit better:

Unhandled Exception: Renci.SshNet.Common.SshException: Failed to open a channel after 10 attempts.
   at Renci.SshNet.Channels.ChannelSession.Open()
   at Renci.SshNet.ScpClient.Download(String filename, FileInfo fileInfo)
   at AtlasSSH.SSHConnection.CopyRemoteFileLocally(String lx, FileInfo localFile, Action`1 statusUpdate, Func`1 failNow)
   at AtlasWorkFlows.Locations.PlaceLinuxRemote.CopyFromRemoteToLocal(String dsName, String[] files, DirectoryInfo ourpath, Action`1 statusUpdate, Func`1 failNow)
   at AtlasWorkFlows.Locations.PlaceLocalWindowsDisk.CopyFromSCPTarget(IPlace origin, Uri[] uris, Action`1 statusUpdate, Func`1 failNow)

I can see the spot where this error occurs in the source code. But the reasons for the error or failure to open seem to fail. This failure occurs after 15 or 20 connections are opened (and I think closed) to the same machine. And it doesn't always happen.

How can I better track down what is causing this failure?

Activity

drieseng

drieseng commented on Sep 24, 2017

@drieseng
Member

Right now, we do not capture the information that a remote host provides when it rejects opening a channel session.

We should capture that information, and include it in the exception we raise after ConnectionInfo.RetryAttempts failed attempts.

changed the title [-]What causes 10 attempts to open a channel fail?[/-] [+]Information provided by remote host is not captured when channel session is rejected[/+] on Sep 24, 2017
drieseng

drieseng commented on Sep 24, 2017

@drieseng
Member

@gordonwatts Until I fix this at our end, you have two options:

  • Consult the log of your SSH server.
  • Modify ChannelSession(OnOpenFailure(uint reasonCode, string description, string language) in SSH.NET to capture and log that info.
gordonwatts

gordonwatts commented on Sep 25, 2017

@gordonwatts
Author

Thanks!

drieseng

drieseng commented on Sep 26, 2017

@drieseng
Member

@gordonwatts Is this blocking you? Have you tried my suggestions above?

gordonwatts

gordonwatts commented on Sep 27, 2017

@gordonwatts
Author

Thanks, no. I re-run a few times and it gets through. I can modify the source so it captures the code and build a myget nuget package to debug what is going on. So, no worries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @drieseng@gordonwatts

        Issue actions

          Information provided by remote host is not captured when channel session is rejected · Issue #305 · sshnet/SSH.NET