microsoft / dev-tunnels-ssh

SSH library for dev-tunnels
MIT License
130 stars 17 forks source link

Error Invalid channel ID in ChannelCloseMessage #66

Closed jeanp413 closed 1 year ago

jeanp413 commented 1 year ago

After fixing https://github.com/microsoft/dev-tunnels-ssh/issues/64 I see this message in the trace logs, I think it's from SshChannel.closeDefault as it closes the channel too early before it receives the corresponding SSH_MSG_CHANNEL_CLOSE (see SSH RFC )

Logs:

Fri Jul 28 2023 16:04:18 [websocket][9102] Receiving #427 ChannelEofMessage (recipientChannel=5) undefined
Fri Jul 28 2023 16:04:18 [websocket][9122] SshChannel(Type: direct-tcpip, Id: 5, RemoteId: 4) EOF received. undefined
Fri Jul 28 2023 16:04:18 [local][9101] Sending #420 ChannelEofMessage (recipientChannel=5) undefined
Fri Jul 28 2023 16:04:18 [local][9102] Receiving #339 ChannelEofMessage (recipientChannel=5) undefined
Fri Jul 28 2023 16:04:18 [local][9122] SshChannel(Type: direct-tcpip, Id: 5, RemoteId: 5) EOF received. undefined
Fri Jul 28 2023 16:04:18 [websocket][9101] Sending #337 ChannelEofMessage (recipientChannel=4) undefined
Fri Jul 28 2023 16:04:18 [local][9102] Receiving #340 ChannelCloseMessage (recipientChannel=5) undefined
Fri Jul 28 2023 16:04:18 [local][9123] SshChannel(Type: direct-tcpip, Id: 5, RemoteId: 5) closed remotely. (S: 4799, R: 2171) undefined
Fri Jul 28 2023 16:04:18 [websocket][9123] Piping channel closure.
Source: SshServerSession SshChannel(Type: direct-tcpip, Id: 5, RemoteId: 5)
Destination: SshClientSession SshChannel(Type: direct-tcpip, Id: 5, RemoteId: 4)
 undefined
Fri Jul 28 2023 16:04:18 [websocket][9101] Sending #338 ChannelCloseMessage (recipientChannel=4) undefined
Fri Jul 28 2023 16:04:18 [websocket][9123] SshChannel(Type: direct-tcpip, Id: 5, RemoteId: 4) closed locally. (S: 2171, R: 4799) undefined
Fri Jul 28 2023 16:04:18 [websocket][9102] Receiving #428 ChannelCloseMessage (recipientChannel=5) undefined
Fri Jul 28 2023 16:04:18 [websocket][9024] Invalid channel ID 5 in ChannelCloseMessage (recipientChannel=5). undefined
jasongin commented 1 year ago

We're seeing this message in dev tunnels logs also. While I don't think it is impacting anything, the channel closure process should be cleaned up.

jasongin commented 1 year ago

The fix is available in package version 3.11.21 or later.