sshnet / sshnet/SSH.NET

Disconnect freeze on .NET CORE 3.1 (MAC, Forward Port)

Open
#741 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

I got freeze after try to disconnect with forward port.

ChannelDirectTcpip.cs

private void ForwardedPort_Closing(object sender, EventArgs eventArgs)
{
    // signal to the client that we will not send anything anymore; this should also interrupt the
    // blocking receive in Bind if the client sends FIN/ACK in time
    ShutdownSocket(SocketShutdown.Send);

    // if the FIN/ACK is not sent in time by the remote client, then interrupt the blocking receive
    // by closing the socket
    CloseSocket();
}

After debug, it freeze on CloseSocket() -> _socket.Dispose()

My solution:
I change
ShutdownSocket(SocketShutdown.Send)
to
ShutdownSocket(SocketShutdown.Both)

Please fix this issue. I don't want to include SSH.NET source code on my project.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ChannelDirectTcpip.cs at ForwardedPort_Closing and trace ShutdownSocket and CloseSocket, especially the _socket.Dispose() call reported to freeze. Reproduce the disconnect with a forward port on .NET Core 3.1 on macOS, then verify that the freeze no longer occurs and add or update coverage for the closing path.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, macos
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.