[ 
https://issues.apache.org/jira/browse/SSHD-207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrew C updated SSHD-207:
--------------------------

    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.

  was:
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 

    
> ChannelForward TCP/IP sends EOF to server after closing channel
> ---------------------------------------------------------------
>
>                 Key: SSHD-207
>                 URL: https://issues.apache.org/jira/browse/SSHD-207
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>            Reporter: Andrew C
>            Assignee: Guillaume Nodet
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to