sshnet / sshnet/SSH.NET

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

Open
#305 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Renci.SshNet.Channels.ChannelSession.Open() and follow the failure into ScpClient.Download(), using the reported stack trace as the entry point. Reproduce the intermittent rejection after repeated connections and determine what remote-host information is lost; done means the failure exposes enough context to identify its cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.