sshnet / sshnet/SSH.NET

SshOperationTimeoutException on Connect() without waiting for timeout

Offen
#944 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C#
Sterne
4.4k
Forks
993
Ø Merge
9 T. 21 Std.
Gemergte PRs (30 T.)
1

Beschreibung

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()

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Einrichtung des ConnectionInfo-Timeouts und dem Einstiegspunkt Connect(), und verfolge dann den Stack Trace durch Session.Connect(), ClientAuthentication.Authenticate() und NoneAuthenticationMethod.Authenticate(). Reproduziere den Fall eines abgewiesenen SSH-Servers und vergleiche, ob Connect() auf das konfigurierte Timeout wartet, AuthenticationFailed auslöst und BannerMessage befüllt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp
Bereich
networking
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.