-
-
Notifications
You must be signed in to change notification settings - Fork 939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tweak AsyncSocketListener in tests #1382
Tweak AsyncSocketListener in tests #1382
Conversation
Some CI runs have been crashing lately from within AsyncSocketListener. This moves a bit of disconnection & exception handling around. It probably won't fix the underlying tests which would have otherwise failed, but it might stop the process from outright crashing. Also reference the same code for the integration tests.
@@ -322,23 +284,36 @@ void ConnectionDisconnected() | |||
} | |||
catch (ObjectDisposedException) | |||
{ | |||
// TODO On .NET 7, sometimes we get ObjectDisposedException when _started but only on appveyor, locally it works | |||
ConnectionDisconnected(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the main problem. If we have received ObjectDisposedException, we don't want to call Shutdown
on the socket because we will get another ObjectDisposedException, and that will crash the process.
This is a very difficult piece of code. Sockets will behave differently on Linux and Windows and in the .NET Framework and modern .NET. In addition, different tests use the |
Yeah, I figured this at least removes one way of crashing. There might still be more |
@@ -8,6 +8,10 @@ | |||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | |||
</PropertyGroup> | |||
|
|||
<ItemGroup> | |||
<Compile Include="$(ProjectDir)../Renci.SshNet.Tests/Common/AsyncSocketListener.cs" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea 👍
Some CI runs have been crashing lately from within AsyncSocketListener. This moves a bit of disconnection & exception handling around. It probably won't fix the underlying tests which would have otherwise failed, but it might stop the process from outright crashing.
Also reference the same code for the integration tests.