[Perf issue] SocketException when disconnecting the SshClient
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 993
- Avg merge
- 9d 21h
- Merged PRs (30d)
- 1
Description
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.
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.'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the SshClient Connect, Disconnect, and Dispose entry points and reproduce the Windows .NET 9 case using the issue's connection loop. Trace the disconnect path around the SocketException and verify that disconnecting or disposing completes without the WSACancelBlockingCall exception or the reported performance hit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100