Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streams and channel not closing after receiving SSH_Message_Channel_Close #116

Open
cbenhagen opened this issue Dec 14, 2024 · 0 comments · May be fixed by #117
Open

Streams and channel not closing after receiving SSH_Message_Channel_Close #116

cbenhagen opened this issue Dec 14, 2024 · 0 comments · May be fixed by #117

Comments

@cbenhagen
Copy link

With open listeners on the stdout stream (ie await shell.stdout.drain();) the channel is not correctly closed when receiving a SSH_Message_Channel_Close message.

<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Userauth_Success
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Open(channelType: session, senderChannel: 0, initialWindowSize: 2097152, maximumPacketSize: 32768)
<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Confirmation(recipientChannel: 0, senderChannel: 0, initialWindowSize: 131072, maximumPacketSize: 131072)
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Request(recipientChannel: 0, requestType: shell, wantReply: true)
<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Success(recipientChannel: 0)
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Data(recipientChannel: 0, data.length=19)
<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Data(recipientChannel: 0, data.length=10)
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Window_Adjust(recipientChannel: 0, bytesToAdd: 10)
<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Data(recipientChannel: 0, data.length=79)
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Window_Adjust(recipientChannel: 0, bytesToAdd: 79)
<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Data(recipientChannel: 0, data.length=86)
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Window_Adjust(recipientChannel: 0, bytesToAdd: 86)
<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Data(recipientChannel: 0, data.length=17)
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Window_Adjust(recipientChannel: 0, bytesToAdd: 17)
<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Data(recipientChannel: 0, data.length=7)
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Window_Adjust(recipientChannel: 0, bytesToAdd: 7)
<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Data(recipientChannel: 0, data.length=17)
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Window_Adjust(recipientChannel: 0, bytesToAdd: 17)
<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_Close(recipientChannel: 0)
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Channel_EOF(recipientChannel: 0)
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Global_Request(requestName: [email protected], wantReply: true)
<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Request_Failure()
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Global_Request(requestName: [email protected], wantReply: true)
<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Request_Failure()
-> _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Global_Request(requestName: [email protected], wantReply: true)
<- _SSHNativeSocket(127.0.0.1:2223): SSH_Message_Request_Failure()

Remote is a SSH-2.0-SwiftNIOSSH_1.0.

cbenhagen added a commit to cbenhagen/dartssh2 that referenced this issue Dec 14, 2024
Fixes TerminalStudio#116

When receiving a SSH_Message_Channel_Close message, the channel was not
being properly closed. This caused the stdout stream to remain open,
preventing the drain() operation from completing.

The fix:
1. Let the channel handle the close message properly
2. Added test to verify channel close behavior
cbenhagen added a commit to cbenhagen/dartssh2 that referenced this issue Dec 14, 2024
Fixes TerminalStudio#116

When receiving a SSH_Message_Channel_Close message, the channel was not
being properly closed. This caused the stdout stream to remain open,
preventing the drain() operation from completing.

The fix:
1. Let the channel handle the close message properly
2. Added test to verify channel close behavior
cbenhagen added a commit to cbenhagen/dartssh2 that referenced this issue Dec 14, 2024
Fixes TerminalStudio#116

When receiving a SSH_Message_Channel_Close message, the channel was not
being properly closed. This caused the stdout stream to remain open,
preventing the drain() operation from completing.

The fix:
1. Let the channel handle the close message properly
2. Added test to verify channel close behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant