sshnet / SSH.NET

SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.
MIT License
3.87k stars 915 forks source link

More AsyncSocketListener patchwork #1408

Closed Rob-Hague closed 1 month ago

Rob-Hague commented 1 month ago

This is Whack-a-mole part 2 in diagnosing or preventing the test host from crashing in CI.

Rob-Hague commented 1 month ago

Here is the/a culprit https://ci.appveyor.com/project/drieseng/ssh-net/builds/49841011/job/44weuub8v0om0tyr/tests

Renci.SshNet.Tests.Classes.Channels.ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.BindShouldHaveFinishedWithoutException

[00:05:05]   Error Message:
[00:05:05]    Assert.IsNull failed. Moq.MockException: ISession.SendMessage(SSH_MSG_CHANNEL_OPEN) invocation failed with mock behavior Strict.
[00:05:05] All invocations on the mock must have a corresponding setup.
[00:05:05]    at Moq.CastleProxyFactory.Interceptor.Intercept(IInvocation underlying) in C:\projects\moq4\src\Moq\Interception\CastleProxyFactory.cs:line 107
[00:05:05]    at Castle.DynamicProxy.AbstractInvocation.Proceed()
[00:05:05]    at Renci.SshNet.Channels.ClientChannel.SendMessage(ChannelOpenMessage message) in /home/appveyor/projects/ssh-net/src/Renci.SshNet/Channels/ClientChannel.cs:line 59
[00:05:05]    at Renci.SshNet.Channels.ChannelDirectTcpip.Open(String remoteHost, UInt32 port, IForwardedPort forwardedPort, Socket socket) in /home/appveyor/projects/ssh-net/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs:line 66
[00:05:05]    at Renci.SshNet.Tests.Classes.Channels.ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.<Arrange>b__20_12(Socket socket) in /home/appveyor/projects/ssh-net/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs:line 143
[00:05:05]   Stack Trace:
[00:05:05]      at Renci.SshNet.Tests.Classes.Channels.ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.BindShouldHaveFinishedWithoutException() in /home/appveyor/projects/ssh-net/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs:line 189
[00:05:05]    at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
[00:05:05]    at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
[00:05:05] 
[00:05:05]   Standard Error Messages:
[00:05:05]  [Renci.SshNet.Tests.Common.AsyncSocketListener] Failure receiving new data: System.Net.Sockets.SocketException (125): Operation canceled
[00:05:05]     at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
[00:05:05]  --- End of stack trace from previous location ---
[00:05:05]     at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
[00:05:05]     at Renci.SshNet.Tests.Common.AsyncSocketListener.ReadCallback(IAsyncResult ar) in /home/appveyor/projects/ssh-net/test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs:line 237
[00:05:05]  [Renci.SshNet.Tests.Common.AsyncSocketListener] Failure shutting down socket: System.ObjectDisposedException: Cannot access a disposed object.
[00:05:05]  Object name: 'System.Net.Sockets.Socket'.
[00:05:05]     at System.Net.Sockets.Socket.Shutdown(SocketShutdown how)
[00:05:05]     at Renci.SshNet.Tests.Common.AsyncSocketListener.Stop() in /home/appveyor/projects/ssh-net/test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs:line 73
Rob-Hague commented 1 month ago

@WojciechNagorski please sign off on this one when you get a chance. No rush

Rob-Hague commented 1 month ago

Thanks