```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 642.
bei Renci.SshNet.Channels.Channel.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 496.
bei Renci.SshNet.Channels.ChannelSession.Open() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\ChannelSession.cs:Zeile 52.
bei Renci.SshNet.ShellStream..ctor(Session session, String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 maxLines, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 73.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 384.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 366.
```
and
```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
bei Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
bei System.Threading.EventWaitHandle.Set()
bei Renci.SshNet.ShellStream.Channel_DataReceived(Object sender, ChannelDataEventArgs e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 739.
bei Renci.SshNet.Channels.Channel.OnData(Byte[] data) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 289.
bei Renci.SshNet.Channels.Channel.OnChannelData(Object sender, MessageEventArgs`1 e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 590.
bei System.EventHandler`1.Invoke(Object sender, TEventArgs e)
bei Renci.SshNet.Session.OnChannelDataReceived(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1392.
bei Renci.SshNet.Session.HandleMessage(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1034.
bei CallSite.Target(Closure , CallSite , Session , Object )
bei Renci.SshNet.Session.HandleMessageCore(Message message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.NET40.cs:Zeile 20.
bei Renci.SshNet.Session.MessageListener() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1589.
```
The application opens a ssh connection and opens/parses a ShellStream every 10 seconds.
IsConnected stays true.
I currently can't test the current beta since it has issues with closing the channel after
disposing the ShellStream.
No errors or unusual log entries on the server side.
Comments: ** Comment from web user: da_rinkes **
Just tried to reproduce the issue with the current sources and I think I found another Issue:
Test-Programm:
https://gist.github.com/darinkes/10024037
Raises Exception after random time:
```
Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server.
bei Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle) in c:\Users\Stefan\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\Session.cs:Zeile 715.
bei Renci.SshNet.Channels.Channel.WaitOnHandle(WaitHandle waitHandle) in c:\Users\Stefan\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\Channels\Channel.cs:Zeile 487.
bei Renci.SshNet.Channels.ChannelSession.SendPseudoTerminalRequest(String environmentVariable, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, IDictionary`2 terminalModeValues) in c:\Users\Stefan\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\Channels\ChannelSession.cs:Zeile 121.
bei Renci.SshNet.ShellStream..ctor(Session session, String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 maxLines, IDictionary`2 terminalModeValues) in c:\Users\Stefan\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\ShellStream.cs:Zeile 73.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize, IDictionary`2 terminalModeValues) in c:\Users\Stefan\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\SshClient.cs:Zeile 392.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize) in c:\Users\Stefan\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\SshClient.cs:Zeile 374.
bei SshNetWaitHandleIssue.Program.<_timer_Elapsed>b__0() in c:\Users\Stefan\Documents\Visual Studio 2012\Projects\SshNetWaitHandleIssue\SshNetWaitHandleIssue\Program.cs:Zeile 62.
```
On the server side sshd prints following:
```
debug1: channel 2: new [server-session]
debug1: session_new: session 2
debug1: session_open: channel 2
debug1: session_open: session 2: link with channel 2
debug1: server_input_channel_open: confirm session
debug1: server_input_channel_req: channel 2 request pty-req reply 1
debug1: session_by_channel: session 2 channel 2
debug1: session_input_channel_req: session 2 req pty-req
debug1: Allocating pty.
debug1: session_new: session 2
mm_request_receive_expect: read: rtype 157 != type 29
debug1: do_cleanup
mm_request_receive: read: Connection reset by peer
debug1: do_cleanup
debug1: PAM: cleanup
debug1: PAM: closing session
debug1: PAM: deleting credentials
debug1: session_pty_cleanup: session 0 release /dev/pts/4
debug1: unregistering ConsoleKit session (null)
debug1: session_pty_cleanup: session 1 release /dev/pts/9
debug1: unregistering ConsoleKit session (null)
debug1: session_pty_cleanup: session 2 release /dev/pts/10
```