sshnet / sshnet/SSH.NET

PrivateKeyAuthenticationMethod.Authenticate can take up to 25000milliseconds

Aperta
#403 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C#
Stelle
4.4k
Fork
993
Merge medio
9g 21h
PR unite (30g)
1

Descrizione

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 !?

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia da PrivateKeyAuthenticationMethod.Authenticate, concentrandoti sulla prima chiamata a session.WaitOnHandle dopo la richiesta di autenticazione a chiave pubblica. Riproduci le variazioni nei tempi sui server segnalati e usa un tracing equivalente per isolare la causa; il lavoro è completato quando il ritardo intermittente è spiegato e viene documentata una correzione verificata o una diagnosi chiara.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
networking
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.