CreateShellStream throwing "Failed to open a channel after 10 attempts" because LocalPacketSize is too big for server side
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 993
- Avg merge
- 9d 21h
- Merged PRs (30d)
- 1
Description
I ran into a problem where an old Extreme Networks switch was always giving “Connect failed: hostname, Renci.SshNet.Common.SshException: Failed to open a channel after 10 attempts” in response to an attempt to call CreateShellStream.
After some debugging I found out that in ChannelSession.cs “private void SendChannelOpenMessage()” ends up setting LocalPacketSize as 65536.
For some reason that switch seems to operate on signed ints and only allows maximum value of 32768. Anything above that and the channel creation error is guaranteed.
For my use I can setup needed correction in source, but could there be a generic way to setup the value in the creation of ShellStream?
Also this servers as FYI for anyone hitting their head against the same problem.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ChannelSession.cs and its private SendChannelOpenMessage() method, then trace how CreateShellStream creates the channel. Investigate how LocalPacketSize is set and how a caller could provide a smaller value for servers with this limitation. Done means the channel can be created with a compatible packet size without breaking the existing behavior.
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
- Mostly clear
- Newbie friendliness
- 45/100