Uploaded image for project: 'MINA SSHD'
  1. MINA SSHD
  2. SSHD-207

ChannelForward TCP/IP sends EOF to server after closing channel

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.8.0
    • 0.9.0
    • None

    Description

      This is the server's log:

      [2013-01-28=15:05:04.742] [NioProcessor-2] DEBUG RelaySession - networkSessionClosed
      [2013-01-28=15:05:04.742] [NioProcessor-2] DEBUG RelaySessionSshChannelSender - Send SSH_MSG_CHANNEL_CLOSE on channel 339
      [2013-01-28=15:05:04.743] [NioProcessor-4] DEBUG SshSession - Received packet SSH_MSG_CHANNEL_CLOSE
      [2013-01-28=15:05:04.743] [NioProcessor-4] DEBUG RelaySessionSshChannelSender - Received SSH_MSG_CHANNEL_CLOSE on channel 339
      [2013-01-28=15:05:04.780] [NioProcessor-4] DEBUG SshSession - Received packet SSH_MSG_CHANNEL_EOF
      [2013-01-28=15:05:04.780] [NioProcessor-4] WARN SshSession - Exception caught
      org.apache.sshd.common.SshException: Received SSH_MSG_CHANNEL_EOF on unknown channel 339

      this is the client log:

      [2013-01-28=15:05:04.741] [NioProcessor-2] DEBUG RelaySessionSshChannelRecipient - Received SSH_MSG_CHANNEL_DATA on channel 339
      [2013-01-28=15:05:04.741] [NioProcessor-682] DEBUG RelaySessionSshChannelRecipient - Send SSH_MSG_CHANNEL_DATA on channel 339
      [2013-01-28=15:05:04.742] [NioProcessor-682] DEBUG RelaySessionSshChannelRecipient - Send SSH_MSG_CHANNEL_EOF on channel 339
      [2013-01-28=15:05:04.743] [NioProcessor-2] DEBUG ClientSessionImpl - Received packet SSH_MSG_CHANNEL_CLOSE
      [2013-01-28=15:05:04.743] [NioProcessor-2] DEBUG RelaySessionSshChannelRecipient - Received SSH_MSG_CHANNEL_CLOSE on channel 339
      [2013-01-28=15:05:04.743] [NioProcessor-2] DEBUG RelaySessionSshChannelRecipient - Send SSH_MSG_CHANNEL_CLOSE on channel 339
      [2013-01-28=15:05:04.743] [NioProcessor-2] DEBUG RelaySessionSshChannelRecipient - Closing channel 339 immediately

      (RelaySessionSshChannelRecipient is just a hacked ChannelForwardTcpip client)

      notice how order of close and eof get switched. I'm assuming it is because this:

      @Override
      public void sessionClosed(IoSession session) throws Exception {
      if (!closing)

      { sendEof(); }

      }

      isn't locking other changes such as the incoming close.

      A simple fix would be to just wrap it in a lock (Ditto for the same code in TcpipServerChannel), however I suspect a better fix would be to not bother with the EOF and just send a CLOSE - I think sending EOF is more applicable to pipes where it is possible to close just one side.

      Attachments

        Issue Links

          Activity

            People

              gnodet Guillaume Nodet
              fixmo-cagney Andrew C
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: