Skip to content

Conversation

@Rob-Hague
Copy link
Collaborator

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.

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.
catch (ObjectDisposedException)
{
// TODO On .NET 7, sometimes we get ObjectDisposedException when _started but only on appveyor, locally it works
ConnectionDisconnected();
Copy link
Collaborator Author

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.

@WojciechNagorski
Copy link
Collaborator

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 AsyncSocketListener differently. But I agree that it should be a little easier.

@Rob-Hague
Copy link
Collaborator Author

Yeah, I figured this at least removes one way of crashing. There might still be more

</PropertyGroup>

<ItemGroup>
<Compile Include="$(ProjectDir)../Renci.SshNet.Tests/Common/AsyncSocketListener.cs" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great idea 👍

@WojciechNagorski WojciechNagorski merged commit 0cfeb6b into sshnet:develop May 10, 2024
@Rob-Hague Rob-Hague deleted the asyncsocketlistener branch May 10, 2024 12:24
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.

3 participants