Skip to content
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

[Perf issue] SocketException when disconnecting the SshClient #1576

Open
raffaeler opened this issue Jan 18, 2025 · 0 comments
Open

[Perf issue] SocketException when disconnecting the SshClient #1576

raffaeler opened this issue Jan 18, 2025 · 0 comments

Comments

@raffaeler
Copy link

System Information:

  • Library version: <PackageReference Include="SSH.NET" Version="2024.2.0" />
  • .NET 9.0
  • Running on Windows 10 x64

Problem:

When I invoke the Disconnect method, a SocketException is thrown.
The problem is that I have to call this code in multiple iterations and I need to re-create the connection every time. The exception is a perf hit.

Image

Image

Repro code:

The repro code is very simple. I tried both Connect and ConnectAsync with no differences.
As soon as I try to either Disconnect or Dispose (which calls Disconnect), the Exception is thrown.

_client = new SshClient(connectionInfo);
_client.Connect();      // //await _client.ConnectAsync(default);
_client.Disconnect();    // Exception explodes here
_client.Dispose();

System.Net.Sockets.SocketException: 'A blocking operation was interrupted by a call to WSACancelBlockingCall.'

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

No branches or pull requests

1 participant