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
I get intermittent exceptions when connecting to an sftp server. I connect once every minute and most of the time it works just fine but a couple of times each day I get "An existing connection was forcibly closed by the remote host".
Looking at it in Wireshark I see the following when things go wrong:
743 2023-02-16 12:54:10,515128 22 TCP 66 57582 → 22 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 WS=256 SACK_PERM=1
744 2023-02-16 12:54:10,538824 57582 TCP 66 22 → 57582 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1390 SACK_PERM=1 WS=128
745 2023-02-16 12:54:10,538914 22 TCP 54 57582 → 22 [ACK] Seq=1 Ack=1 Win=262656 Len=0
746 2023-02-16 12:54:10,539031 22 SSHv2 92 Client: Protocol (SSH-2.0-Renci.SshNet.SshClient.0.0.1)
747 2023-02-16 12:54:10,561823 57582 TCP 60 22 → 57582 [ACK] Seq=1 Ack=39 Win=29312 Len=0
748 2023-02-16 12:54:10,566251 57582 TCP 60 22 → 57582 [RST, ACK] Seq=1 Ack=39 Win=29312 Len=0
But most of the time it looks like this, which is fine:
749 2023-02-16 12:54:20,580048 22 TCP 66 57584 → 22 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 WS=256 SACK_PERM=1
750 2023-02-16 12:54:20,606751 57584 TCP 66 22 → 57584 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1390 SACK_PERM=1 WS=128
751 2023-02-16 12:54:20,606826 22 TCP 54 57584 → 22 [ACK] Seq=1 Ack=1 Win=262656 Len=0
752 2023-02-16 12:54:20,606989 22 SSHv2 92 Client: Protocol (SSH-2.0-Renci.SshNet.SshClient.0.0.1)
753 2023-02-16 12:54:20,630003 57584 TCP 60 22 → 57584 [ACK] Seq=1 Ack=39 Win=29312 Len=0
754 2023-02-16 12:54:20,644309 57584 SSHv2 75 Server: Protocol (SSH-2.0-OpenSSH_8.0)
755 2023-02-16 12:54:20,688760 22 TCP 54 57584 → 22 [ACK] Seq=39 Ack=22 Win=262656 Len=0
If I switch to WinScp or Rebex it works without any issues.
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
The report names no repository file, test, or code entry point. Start by reproducing repeated SFTP connections and comparing the successful and reset SSH negotiation traces; determine whether SSH.NET or the remote host causes the intermittent closure. Done means the cause is established and a verified fix or actionable limitation is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100