Skip to content

[Perf issue] SocketException when disconnecting the SshClient #1576

@raffaeler

Description

@raffaeler

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.'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions