An existing connection was forcibly closed by the remote host
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 993
- Avg merge
- 9d 21h
- Merged PRs (30d)
- 1
Description
Dear all,
we are using SSH.NET 2024.2.0.0 with a .NET 4.7.2 console application to download files via SFTP from our german provider Strato.
We sporadically have the problem that we receive the error 10054 (An existing connection was forcibly closed by the remote host) when downloading files. Sometimes this occurs after a few minutes and sometimes after a few seconds.
We have tried the following:
- Run our application on different PCs => Error occurs
- Waited between 200ms and 1000ms before downloading each file => error occurs
- Run app via on a different internet connection => Error occurs
- Used an internal SSH server => Error does not occur! In this test, we let it run for several hours
In all our tests, we simply downloaded files via SFTP in the loop and waited.
Then we followed the debug instruction of SSH.NET and compiled SSH.NET using the debug function and activated the trace.
If we have activated the trace, the error does not occur.
If we deactivate the source “System.Net.Sockets” in the trace and only activate the source “SshNet.Logging”, the problem occurs (trace attached)
If we have only activated “System.Net.Sockets” in the trace, the problem does not occur - regardless of whether we are using a TextWriter or a ConsoleWriter.
Due to the fact that it sometimes occurs when the trace is activated and sometimes not, we rather suspect a bug in SSH.NET. Especially because we used to download the files with WinSCP / Filezilla and never had any problems.
Here is the exception:
The trace trace.sshnet.log in the attachment.
Best regards
Rainer
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 by reviewing the attached trace.sshnet.log and the reported SocketException while reproducing the repeated SFTP download loop against the Strato server. Compare behavior with SshNet.Logging enabled versus System.Net.Sockets tracing. Done means identifying whether SSH.NET is responsible and documenting or implementing a verified fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100