Exception "Session operation has timed out" upon connect to some hosts
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 993
- Avg merge
- 9d 21h
- Merged PRs (30d)
- 1
Description
I'm having a really odd occurrence and I've troubleshooted back to this library - or a combination of factors, including this library.
SSH.NET is working great to hundreds of devices behind multiple firewalls - but! I have a handful of devices behind a specific firewall that I'm trying to establish SSH sessions to. I can fire up putty and SSH to any one of them fine (all defaults, from the same source host), yet when I attempt to connect with SSH.NET I get the following exception (on the .Connect() line);
Error Message
Session operation has timed out
Stack Trace
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle)
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.Connect()
at test.Ssh.Client.Connect() in C:\Users\dev\source\test\Ssh.vb:line 59
Increasing the timeout makes no difference, besides, Putty connects instantly. User/pass makes no diff if right or wrong, error is the same.
Is there any way to get any debug logging out of SSH.NET?
Any other ideas?
Basic Code to Re-Produce
Imports Renci.SshNet
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim cl As New SshClient("172.16.0.2", "test.user", "test.pass")
Try
cl.Connect()
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
End Sub
End Class
This code will probably work fine when you test it - because it does for nearly all my hosts too - just these select few!
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 the reported VB reproduction at Ssh.vb line 59 and trace Renci.SshNet.BaseClient.Connect through Session.Connect and Session.WaitOnHandle. Compare the failing hosts with the working PuTTY connections and determine whether SSH.NET can expose useful debug logging or a specific cause for the timeout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100