When the command execution terminates, the server starts the closing of the channel by sending EOF, the exit status and the CLOSE message. The client is supposed to send back a CLOSE message to indicate that the channel should actually be closed. It seems the client behaves badly. Which client do you use ?
2013/11/23 <[email protected]> > Hello, all! > > > > I noted that, after receiving a given amount of data, the server session > is not able to close the connection properly. > > > > > A good connection with a small amount of data transferred looks like the > following: > > > > > > ==> Call to onExit callback. > > [pool-3-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - > Send SSH_MSG_CHANNEL_EOF on channel 101 > > [pool-3-thread-1] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - > Writing 52 bytes > > [pool-3-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - > Send SSH_MSG_CHANNEL_REQUEST exit-status on channel 101 > > [pool-2-thread-2] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - Read > 36 bytes > > [pool-3-thread-1] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - > Writing 68 bytes > > [pool-2-thread-2] DEBUG org.apache.sshd.server.session.ServerSession - > Received packet SSH_MSG_CHANNEL_EOF > > [pool-2-thread-2] DEBUG org.apache.sshd.server.channel.ChannelSession - > Received SSH_MSG_CHANNEL_EOF on channel 101 > > [pool-3-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - > Closing channel 101 gracefully > > [pool-3-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - > Wait 5s for shell to exit cleanly > > [pool-2-thread-3] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - Read > 36 bytes > > [pool-2-thread-3] DEBUG org.apache.sshd.server.session.ServerSession - > Received packet SSH_MSG_CHANNEL_CLOSE > > [pool-2-thread-3] DEBUG org.apache.sshd.server.channel.ChannelSession - > Received SSH_MSG_CHANNEL_CLOSE on channel 101 > > ==> Received the destroy() callback. > > [pool-3-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - > Send SSH_MSG_CHANNEL_CLOSE on channel 101 > > [pool-3-thread-1] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - > Writing 52 bytes > > [pool-2-thread-5] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - > Socket has been disconnected, closing IoSession now > > [pool-2-thread-5] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - > Closing Nio2Session > > [pool-2-thread-5] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - > Closing socket > > [pool-2-thread-5] DEBUG org.apache.sshd.server.session.ServerSession - > Closing session > > [pool-2-thread-5] DEBUG org.apache.sshd.server.session.ServerSession - > Closing IoSession > > [pool-2-thread-5] DEBUG org.apache.sshd.server.session.ServerSession - > IoSession closed > > [pool-2-thread-5] INFO org.apache.sshd.server.session.ServerSession - > Session 123@/0:0:0:0:0:0:0:1:62075 closed > > > > > And this is what happen to a connection that is not clearly closed: > > > > > > > ==> Call to onExit callback. > > > [pool-3-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - > Send SSH_MSG_CHANNEL_EOF on channel 101 > > [pool-3-thread-1] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - > Writing 52 bytes > > [pool-3-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - > Send SSH_MSG_CHANNEL_REQUEST exit-status on channel 101 > > [pool-2-thread-4] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - Read > 36 bytes > > [pool-3-thread-1] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - > Writing 68 bytes > > [pool-2-thread-4] DEBUG org.apache.sshd.server.session.ServerSession - > Received packet SSH_MSG_CHANNEL_EOF > > [pool-2-thread-4] DEBUG org.apache.sshd.server.channel.ChannelSession - > Received SSH_MSG_CHANNEL_EOF on channel 101 > > [pool-3-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - > Closing channel 101 gracefully > > [pool-3-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - > Wait 5s for shell to exit cleanly > > [pool-3-thread-1] DEBUG org.apache.sshd.server.channel.ChannelSession - > Send SSH_MSG_CHANNEL_CLOSE on channel 101 > > [pool-3-thread-1] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - > Writing 52 bytes > > > > > In this second faulty example, the destroy method is never called and the > connection only closes with the 10 minutes (600000ms) threshold. > > > > > Is it a kind of bug or am I misusing the application? Note that I'm not > running a shell application, but in this place I'm creating a Lanterna ( > code.google.com/p/lanterna) based shell directly by implementing Command > interface and its factory. In order to confirm this behavior I tried to run > the default SSHD implementation (SshServer.main(String[] args)) and it's > still getting the same errors. > > > > > Does someone have any idea about how to get it working? > > > > > > Thanks, > > > > > Renato A. Ferreira > > > > > > > Enviado do Email do Windows -- ----------------------- Guillaume Nodet ------------------------ Red Hat, Open Source Integration Email: [email protected] Web: http://fusesource.com Blog: http://gnodet.blogspot.com/
