I use renci.sshnet in a multi-threaded/multi-concurrent-connection environment and was observing randome generic exceptions being thrown during heavy testing.
> Using Revision: 28765
The problem was found in Session.cs lines 637 through 646:
```
switch (EventWaitHandle.WaitAny(waitHandles, this.ConnectionInfo.Timeout))
{
// case 0:
// throw this._exception;
case System.Threading.WaitHandle.WaitTimeout:
this.SendDisconnect(DisconnectReason.ByApplication, "Operation timeout");
throw new SshOperationTimeoutException("Session operation has timed out");
default:
break;
}
```
With lines 639 and 670, here commented out, the random general exception was no longer thrown. Upon inspection it was found that the __WaitAny()__ call returns a zero base index to the event handle, in the passed in array of handles, that caused the wait to release. Thus, zero is a valid return value implying wait success. It should not have thrown an exception.
Comments: Reporter cannot upgrade to latest version to see if issue is fixed.
> Using Revision: 28765
The problem was found in Session.cs lines 637 through 646:
```
switch (EventWaitHandle.WaitAny(waitHandles, this.ConnectionInfo.Timeout))
{
// case 0:
// throw this._exception;
case System.Threading.WaitHandle.WaitTimeout:
this.SendDisconnect(DisconnectReason.ByApplication, "Operation timeout");
throw new SshOperationTimeoutException("Session operation has timed out");
default:
break;
}
```
With lines 639 and 670, here commented out, the random general exception was no longer thrown. Upon inspection it was found that the __WaitAny()__ call returns a zero base index to the event handle, in the passed in array of handles, that caused the wait to release. Thus, zero is a valid return value implying wait success. It should not have thrown an exception.
Comments: Reporter cannot upgrade to latest version to see if issue is fixed.