sshnet / sshnet/SSH.NET

ObjectDisposedException once in a while

Aperta
#560 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

https://github.com/sshnet/SSH.NET/blob/7691cb0b55f5e0de8dc2ad48dd824419471ab710/src/Renci.SshNet/ForwardedPortLocal.NET.cs#L63

We are seeing ObjectDisposedExceptions once in a while:

Frameworkversion: v4.0.30319
Beschreibung: Der Prozess wurde aufgrund einer unbehandelten Ausnahme beendet.
Ausnahmeinformationen: System.ObjectDisposedException
bei System.Net.Sockets.Socket.AcceptAsync(System.Net.Sockets.SocketAsyncEventArgs)
bei Renci.SshNet.ForwardedPortLocal.StartAccept(System.Net.Sockets.SocketAsyncEventArgs)
bei Renci.SshNet.ForwardedPortLocal.AcceptCompleted(System.Object, System.Net.Sockets.SocketAsyncEventArgs)
bei System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(System.Net.Sockets.SocketAsyncEventArgs)
bei System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
bei System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
bei System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
bei System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(System.Net.Sockets.SocketError, Int32, System.Net.Sockets.SocketFlags)
bei System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
bei System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)

These exceptions should be prevented in SSH.Net by catching the exception and ignoring it if the status is Stopped or Stopping. The status is set to Stopping before the _listener is disposed.
However, the status is checked for Stopped twice, instead of Stopping or Stopped. This is a simple oversight.

Same thing in ForwardedPortDynamic.NET.cs

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 in src/Renci.SshNet/ForwardedPortLocal.NET.cs, in StartAccept, e ispeziona il controllo dello stato relativo alla dismissione del listener, quindi confronta la logica corrispondente in ForwardedPortDynamic.NET.cs. Riproduci o analizza il completamento di un accept durante l’arresto; il lavoro è completato quando le istanze di ObjectDisposedException durante l’arresto vengono impedite in entrambe le implementazioni di forwarded-port.

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

Valutazione

Stack tecnologico
csharp
Ambito
networking
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.