Skip to content

Conversation

Rob-Hague
Copy link
Collaborator

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

This is Whack-a-mole part 2 in diagnosing or preventing the test host from crashing in CI.
{
bytesRead = 0;
}
bytesRead = handler.EndReceive(ar);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite being documented as throwing, EndReceive(IAsyncResult, out SocketError) actually suppresses exceptions and translates them into the out SocketError parameter, at which point we would continue on and call ConnectionDisconnected(true), giving another way to crash.

@Rob-Hague
Copy link
Collaborator Author

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 Rob-Hague marked this pull request as ready for review May 19, 2024 08:32
@Rob-Hague
Copy link
Collaborator Author

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

@WojciechNagorski WojciechNagorski merged commit aa70718 into sshnet:develop May 19, 2024
@Rob-Hague
Copy link
Collaborator Author

Thanks

@Rob-Hague Rob-Hague deleted the socketlistener2 branch May 19, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants