sshnet / sshnet/SSH.NET

SshOperationTimeoutException on Connect() without waiting for timeout

Open
#944 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi,

My CI/CD suite contains several SSH tests.
Some of the tests are connecting to an SSH server that rejects them and asserting what was the BannerMessage error.

Somehow, when I change a completely irrelevant code (changed my Redis client Nuget package) - these tests fail!
The behaviour for calling Connect() changes all of sudden, throwing exception immediately, without raising the AuthenticationFailed event and populating the BannerMessage error.
I'm setting timeouts properly on the ConnectionInfo -

return new ConnectionInfo(host, port, username) 
{
     Timeout = TimeSpan.FromSeconds(60),
     ChannelCloseTimeout = TimeSpan.FromSeconds(10),
     RetryAttempts = 3
}

this is the stack trace

Renci.SshNet.Common.SshOperationTimeoutException: Session operation has timed out
[xUnit.net 00:06:42.81] at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)
[xUnit.net 00:06:42.81] at Renci.SshNet.NoneAuthenticationMethod.Authenticate(Session session)
[xUnit.net 00:06:42.81] at Renci.SshNet.ClientAuthentication.Authenticate(IConnectionInfoInternal connectionInfo, ISession session)
[xUnit.net 00:06:42.81] at Renci.SshNet.ConnectionInfo.Authenticate(ISession session, IServiceFactory serviceFactory)
[xUnit.net 00:06:42.81] at Renci.SshNet.Session.Connect()
[xUnit.net 00:06:42.81] at Renci.SshNet.BaseClient.CreateAndConnectSession()
[xUnit.net 00:06:42.81] at Renci.SshNet.BaseClient.Connect()

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 with the ConnectionInfo timeout setup and the Connect() entry point, then follow the stack trace through Session.Connect(), ClientAuthentication.Authenticate(), and NoneAuthenticationMethod.Authenticate(). Reproduce the rejected-SSH-server case and compare whether Connect() waits for the configured timeout, raises AuthenticationFailed, and populates BannerMessage.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.