sshnet / sshnet/SSH.NET

PrivateKeyAuthenticationMethod.Authenticate can take up to 25000milliseconds

Offen
#403 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

Hello,

I am facing a weird issue where connection to a server (SSH or SFTP) can sometimes take a very long time though the network condition are quite good. I have drilled down to Authenticate method of PrivateKeyAuthenticationMethod class and put some tracing around the first WaitOnHandle:

                //  Send public key authentication request
                session.SendMessage(message);

System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();
session.WaitOnHandle(_authenticationCompleted);
System.Diagnostics.Trace.WriteLine($"PK AUTH doing {keyFile.HostKey.Name} took {sw.ElapsedMilliseconds} milliseconds");

Here are some results:
PK AUTH doing ssh-rsa took 9108 milliseconds
PK AUTH doing ssh-rsa took 315 milliseconds
PK AUTH doing ssh-rsa took 262 milliseconds
PK AUTH doing ssh-rsa took 310 milliseconds
PK AUTH doing ssh-rsa took 271 milliseconds
PK AUTH doing ssh-rsa took 1126 milliseconds
PK AUTH doing ssh-rsa took 258 milliseconds
PK AUTH doing ssh-rsa took 322 milliseconds
PK AUTH doing ssh-rsa took 8649 milliseconds
PK AUTH doing ssh-rsa took 311 milliseconds
PK AUTH doing ssh-rsa took 2674 milliseconds
PK AUTH doing ssh-rsa took 317 milliseconds
PK AUTH doing ssh-rsa took 260 milliseconds
PK AUTH doing ssh-rsa took 280 milliseconds
PK AUTH doing ssh-rsa took 10827 milliseconds
PK AUTH doing ssh-rsa took 276 milliseconds
PK AUTH doing ssh-rsa took 254 milliseconds
PK AUTH doing ssh-rsa took 271 milliseconds

PK AUTH doing ssh-rsa took 265 milliseconds
PK AUTH doing ssh-rsa took 1694 milliseconds
PK AUTH doing ssh-rsa took 3949 milliseconds
PK AUTH doing ssh-rsa took 315 milliseconds
PK AUTH doing ssh-rsa took 267 milliseconds
PK AUTH doing ssh-rsa took 1021 milliseconds
PK AUTH doing ssh-rsa took 261 milliseconds
PK AUTH doing ssh-rsa took 318 milliseconds
PK AUTH doing ssh-rsa took 256 milliseconds
PK AUTH doing ssh-rsa took 310 milliseconds
PK AUTH doing ssh-rsa took 257 milliseconds
PK AUTH doing ssh-rsa took 321 milliseconds
PK AUTH doing ssh-rsa took 255 milliseconds
PK AUTH doing ssh-rsa took 2486 milliseconds
PK AUTH doing ssh-rsa took 251 milliseconds
PK AUTH doing ssh-rsa took 273 milliseconds
PK AUTH doing ssh-rsa took 252 milliseconds
PK AUTH doing ssh-rsa took 20895 milliseconds

This has been executed twice against 12 servers (physically different, but exactly the same from software perspective) in the same network conditions.
I can't figure out what could be the problem and I can't imagine why such authentication usually takes 300 milliseconds but cam raise up to 25000ms !?

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 bei PrivateKeyAuthenticationMethod.Authenticate und konzentriere dich auf den ersten session.WaitOnHandle-Aufruf nach der Public-Key-Authentifizierungsanfrage. Reproduziere die unterschiedlichen Zeitabläufe auf den gemeldeten Servern und verwende eine gleichwertige Ablaufverfolgung, um die Ursache einzugrenzen; abgeschlossen ist die Aufgabe, wenn die intermittierende Verzögerung erklärt und eine verifizierte Behebung oder eine klare Diagnose dokumentiert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp
Bereich
networking
Issue-Typ
Bug
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

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