santhsr opened a new issue, #460:
URL: https://github.com/apache/mina-sshd/issues/460
### Version
2.9.2
### Bug description
Im getting time out exception after 10 min . If the command executes before
ten minutes the program is working as expected.
### Actual behavior
public static void main(String[] args) throws IOException,
InterruptedException {
SshClient sshClient = SshClient.setUpDefaultClient();
sshClient.setForwardingFilter(new AcceptAllForwardingFilter());
sshClient.start();
//if (connectFuture.isConnected()) {
// SSH connection is established
ClientSession session = sshClient.connect("root", "XXXX",
22).verify().getSession();
session.addPasswordIdentity("yyyy");
session.auth().verify();
//Setting up env variables
ChannelExec channel = session.createExecChannel("sleep 20m");
//channel.setOut(new NoCloseOutputStream(System.out));
//channel.setErr(new NoCloseOutputStream(System.err));
channel.open().verify(30, TimeUnit.MINUTES);
System.out.println("*******************");
// Wait (forever) for the channel to close - signalling shell
exited
channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED), 0L);
while (!channel.isClosed()) {
Thread.sleep(1000);
}
int exitCode = channel.getExitStatus();
//}
}
### Expected behavior
The program should run with out exception
### Relevant log output
```Shell
20:01:48.913 [sshd-SshClient[7426a448]-nio2-thread-3] DEBUG
org.apache.sshd.client.session.ClientSessionImpl -
doHandleMessage(ClientSessionImpl[[email protected]/10.194.171.39:22])
process #9 SSH_MSG_CHANNEL_WINDOW_ADJUST
20:01:48.913 [sshd-SshClient[7426a448]-nio2-thread-3] DEBUG
org.apache.sshd.client.channel.ChannelExec -
handleWindowAdjust(ChannelExec[id=0,
recipient=0]-ClientSessionImpl[[email protected]/10.194.171.39:22])
SSH_MSG_CHANNEL_WINDOW_ADJUST window=2097152
20:01:48.914 [sshd-SshClient[7426a448]-nio2-thread-3] DEBUG
org.apache.sshd.common.channel.RemoteWindow -
expand(RemoteWindow[client](ChannelExec[id=0,
recipient=0]-ClientSessionImpl[[email protected]/10.194.171.39:22]))
increase window from 0 by 2097152 up to 2097152
20:11:49.206 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.session.ClientSessionImpl -
checkForTimeouts(ClientSessionImpl[[email protected]/10.194.171.39:22])
disconnect - reason=TimeoutIndicator[status=IdleTimeout, threshold=600000,
expired=600292]
20:11:49.209 [sshd-SshClient[7426a448]-timer-thread-1] INFO
org.apache.sshd.client.session.ClientSessionImpl -
Disconnecting(ClientSessionImpl[[email protected]/10.194.171.39:22]):
SSH2_DISCONNECT_PROTOCOL_ERROR - Detected IdleTimeout after 600292/600000 ms.
20:11:49.213 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.session.ClientSessionImpl -
encode(ClientSessionImpl[[email protected]/10.194.171.39:22])
packet #8 sending command=1[SSH_MSG_DISCONNECT] len=57
20:11:49.213 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.io.nio2.Nio2Session -
writeBuffer(Nio2Session[local=/[0:0:0:0:0:0:0:0]:65194,
remote=quartz-be9b-host.spse-maas/10.194.171.39:22]) writing 92 bytes
20:11:49.216 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.session.ClientSessionImpl -
disconnect(ClientSessionImpl[[email protected]/10.194.171.39:22])
operation successfully completed for reason=SSH2_DISCONNECT_PROTOCOL_ERROR
[Detected IdleTimeout after 600292/600000 ms.]
20:11:49.216 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.session.ClientSessionImpl -
close(ClientSessionImpl[[email protected]/10.194.171.39:22])
Closing immediately
20:11:49.217 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.session.ClientSessionImpl -
signalAuthFailure(ClientSessionImpl[[email protected]/10.194.171.39:22])
type=SshException, signalled=false, first=false: Session is being closed
20:11:49.217 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.session.helpers.SessionTimeoutListener -
sessionClosed(ClientSessionImpl[[email protected]/10.194.171.39:22])
un-tracked
20:11:49.220 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.session.ClientConnectionService -
close(ClientConnectionService[ClientSessionImpl[[email protected]/10.194.171.39:22]])
Closing immediately
20:11:49.220 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.session.ClientConnectionService -
stopHeartBeat(ClientSessionImpl[[email protected]/10.194.171.39:22])
no heartbeat to stop
20:11:49.220 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.channel.ChannelExec - close(ChannelExec[id=0,
recipient=0]-ClientSessionImpl[[email protected]/10.194.171.39:22])
Closing immediately
20:11:49.220 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.channel.ChannelExec - close(ChannelExec[id=0,
recipient=0]-ClientSessionImpl[[email protected]/10.194.171.39:22])
no EOF sent
20:11:49.220 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.channel.LocalWindow - Closing
LocalWindow[client](ChannelExec[id=0,
recipient=0]-ClientSessionImpl[[email protected]/10.194.171.39:22])
20:11:49.220 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.channel.RemoteWindow - Closing
RemoteWindow[client](ChannelExec[id=0,
recipient=0]-ClientSessionImpl[[email protected]/10.194.171.39:22])
20:11:49.223 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.channel.ChannelExec - sendEof(ChannelExec[id=0,
recipient=0]-ClientSessionImpl[[email protected]/10.194.171.39:22])
already closing or closed - state=Immediate
20:11:49.223 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.channel.AbstractChannel$GracefulChannelCloseable -
close(ChannelExec[id=0,
recipient=0]-ClientSessionImpl[[email protected]/10.194.171.39:22])[immediately=true]
processing
20:11:49.223 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.session.ClientConnectionService -
unregisterChannel(ChannelExec[id=0,
recipient=0]-ClientSessionImpl[[email protected]/10.194.171.39:22])
result=ChannelExec[id=0,
recipient=0]-ClientSessionImpl[[email protected]/10.194.171.39:22]
20:11:49.223 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.util.closeable.SequentialCloseable -
doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@54a35905)
signal close complete immediately=true
20:11:49.223 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.util.closeable.SequentialCloseable -
doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@6fc6ce6a)
signal close complete immediately=true
20:11:49.223 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.util.closeable.SequentialCloseable -
doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@17097791)
signal close complete immediately=true
20:11:49.223 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.channel.ChannelExec - close(ChannelExec[id=0,
recipient=0]-ClientSessionImpl[[email protected]/10.194.171.39:22])[Immediately]
closed
20:11:49.223 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.session.ClientConnectionService -
close(ClientConnectionService[ClientSessionImpl[[email protected]/10.194.171.39:22]])[Immediately]
closed
20:11:49.224 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.io.nio2.Nio2Session -
close(Nio2Session[local=/[0:0:0:0:0:0:0:0]:65194,
remote=quartz-be9b-host.spse-maas/10.194.171.39:22]) Closing immediately
20:11:49.224 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.io.nio2.Nio2Session -
doCloseImmediately(Nio2Session[local=/[0:0:0:0:0:0:0:0]:65194,
remote=quartz-be9b-host.spse-maas/10.194.171.39:22]) closing
socket=sun.nio.ch.WindowsAsynchronousSocketChannelImpl[connected
local=/[0:0:0:0:0:0:0:0]:65194
remote=quartz-be9b-host.spse-maas/10.194.171.39:22]
20:11:49.224 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.io.nio2.Nio2Session -
doCloseImmediately(Nio2Session[local=/[0:0:0:0:0:0:0:0]:65194,
remote=quartz-be9b-host.spse-maas/10.194.171.39:22])
socket=sun.nio.ch.WindowsAsynchronousSocketChannelImpl[closed] closed
20:11:49.224 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.io.nio2.Nio2Connector - unmapSession(id=101):
Nio2Session[local=/[0:0:0:0:0:0:0:0]:65194,
remote=quartz-be9b-host.spse-maas/10.194.171.39:22]
20:11:49.224 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.session.ClientSessionImpl -
close(ClientSessionImpl[[email protected]/10.194.171.39:22])[Immediately]
state already Immediate
20:11:49.224 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.io.nio2.Nio2Session -
close(Nio2Session[local=/[0:0:0:0:0:0:0:0]:65194,
remote=quartz-be9b-host.spse-maas/10.194.171.39:22])[Immediately] closed
20:11:49.224 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.common.util.closeable.SequentialCloseable -
doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@2e6a12d)
signal close complete immediately=true
20:11:49.224 [sshd-SshClient[7426a448]-timer-thread-1] DEBUG
org.apache.sshd.client.session.ClientSessionImpl -
close(ClientSessionImpl[[email protected]/10.194.171.39:22])[Immediately]
closed
20:11:49.225 [sshd-SshClient[7426a448]-nio2-thread-4] DEBUG
org.apache.sshd.common.io.nio2.Nio2Session -
handleReadCycleFailure(Nio2Session[local=/[0:0:0:0:0:0:0:0]:65194,
remote=quartz-be9b-host.spse-maas/10.194.171.39:22]) AsynchronousCloseException
after 600318752100 nanos at read cycle=10: null
Exception in thread "main" java.lang.NullPointerException: Cannot invoke
"java.lang.Integer.intValue()" because the return value of
"org.apache.sshd.client.channel.ChannelExec.getExitStatus()" is null
at com.spse.bmcapi.controller.Test.main(Test.java:53)
```
### Other information
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]