raghamadhu opened a new issue, #578:
URL: https://github.com/apache/mina-sshd/issues/578
### Version
2.13.1
### Bug description
We are using Apache Mina to connect to an RHEL server, and intermittently we
are getting IOException - "The semaphore timeout period has expired" while
using Apache Mina SshClient.
This error only occurs when connecting from a Windows client.
Error only occurs 3 in 10 times. We are trying to execute commands on the
remote server using ChannelExec::open method.
### Actual behavior
We are using ClientBuilder to build the client as below
'client =
ClientBuilder.builder().hostConfigEntryResolver(hostConfigEntryResolver)
' .serverKeyVerifier(AcceptAllServerKeyVerifier.INSTANCE)
'
.forwardingFilter(AcceptAllForwardingFilter.INSTANCE).build();
Session heartbeat is set to 10 seconds and we are starting the client.
' client.start();
Using the session object created, we are opening an ExecChannel, to execute
linux commands.
` channelExec = session.createExecChannel("<command to execute>")
` channelExec.open()
This closes the complete session in the client. which interrupts command
execution in other channels too.
### Expected behavior
while a connection is open, and no network disturbances, this should not
happen.
### Relevant log output
```Shell
2024-08-07 13:09:25,424 DEBUG [sshd-SshClient[569b3009]-timer-thread-1]
o.a.s.c.i.n.Nio2Session writeBuffer(Nio2Session[local=/0:0:0:0:0:0:0:0:64688,
remote=vmr-iod-1001.ete.ka.sw.ericsson.se/10.223.58.242:22]) writing 60 bytes
2024-08-07 13:09:25,574 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.i.n.Nio2Session
handleReadCycleFailure(Nio2Session[local=/0:0:0:0:0:0:0:0:64688,
remote=vmr-iod-1001.ete.ka.sw.ericsson.se/10.223.58.242:22]) IOException after
19180462400 nanos at read cycle=34: The semaphore timeout period has expired.
2024-08-07 13:09:25,574 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.i.n.Nio2Session
exceptionCaught(Nio2Session[local=/0:0:0:0:0:0:0:0:64688,
remote=vmr-iod-1001.ete.ka.sw.ericsson.se/10.223.58.242:22]) caught
IOException[The semaphore timeout period has expired.
] - calling handler
2024-08-07 13:09:25,574 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.s.ClientSessionImpl
signalAuthFailure(ClientSessionImpl[[email protected]/10.223.58.242:22])
type=IOException, signalled=false, first=false: The semaphore timeout period
has expired.
2024-08-07 13:09:25,574 WARN [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.s.ClientSessionImpl
exceptionCaught(ClientSessionImpl[[email protected]/10.223.58.242:22])[state=Opened]
IOException: The semaphore timeout period has expired.
java.io.IOException: The semaphore timeout period has expired.
at sun.nio.ch.Iocp.translateErrorToIOException(Iocp.java:309)
at sun.nio.ch.Iocp.access$700(Iocp.java:46)
at sun.nio.ch.Iocp$EventHandlerTask.run(Iocp.java:399)
at java.lang.Thread.run(Thread.java:750)
2024-08-07 13:09:25,574 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.s.h.SessionTimeoutListener
sessionException(ClientSessionImpl[[email protected]/10.223.58.242:22])
IOException: The semaphore timeout period has expired.
2024-08-07 13:09:25,574 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.s.h.SessionTimeoutListener
sessionClosed(ClientSessionImpl[[email protected]/10.223.58.242:22])
un-tracked
2024-08-07 13:09:25,574 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.s.ClientSessionImpl
close(ClientSessionImpl[[email protected]/10.223.58.242:22])
Closing immediately
2024-08-07 13:09:25,589 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.s.ClientSessionImpl
signalAuthFailure(ClientSessionImpl[[email protected]/10.223.58.242:22])
type=SshException, signalled=false, first=false: Session is being closed
2024-08-07 13:09:25,589 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.s.ClientConnectionService
close(ClientConnectionService[ClientSessionImpl[[email protected]/10.223.58.242:22]])
Closing immediately
2024-08-07 13:09:25,589 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.s.ClientConnectionService
stopHeartBeat(ClientSessionImpl[[email protected]/10.223.58.242:22])
stopping
2024-08-07 13:09:25,589 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.s.ClientConnectionService
stopHeartBeat(ClientSessionImpl[[email protected]/10.223.58.242:22])
stopped
2024-08-07 13:09:25,589 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.c.ChannelExec close(ChannelExec[id=0,
recipient=1]-ClientSessionImpl[[email protected]/10.223.58.242:22])
Closing immediately
2024-08-07 13:09:25,589 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.c.ChannelExec close(ChannelExec[id=0,
recipient=1]-ClientSessionImpl[[email protected]/10.223.58.242:22])
no EOF sent
2024-08-07 13:09:25,589 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.c.LocalWindow Closing LocalWindow[client](ChannelExec[id=0,
recipient=1]-ClientSessionImpl[[email protected]/10.223.58.242:22])
2024-08-07 13:09:25,589 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.c.RemoteWindow Closing RemoteWindow[client](ChannelExec[id=0,
recipient=1]-ClientSessionImpl[[email protected]/10.223.58.242:22])
2024-08-07 13:09:25,589 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.c.ChannelExec sendEof(ChannelExec[id=0,
recipient=1]-ClientSessionImpl[[email protected]/10.223.58.242:22])
already closing or closed - state=Immediate
2024-08-07 13:09:25,589 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.c.AbstractChannel$GracefulChannelCloseable close(ChannelExec[id=0,
recipient=1]-ClientSessionImpl[[email protected]/10.223.58.242:22])[immediately=true]
processing
2024-08-07 13:09:25,589 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.s.ClientConnectionService unregisterChannel(ChannelExec[id=0,
recipient=1]-ClientSessionImpl[[email protected]/10.223.58.242:22])
result=ChannelExec[id=0,
recipient=1]-ClientSessionImpl[[email protected]/10.223.58.242:22]
2024-08-07 13:09:25,589 DEBUG [sshd-SshClient[569b3009]-nio2-thread-5]
o.a.s.c.u.c.SequentialCloseable
doClose(org.apache.sshd.common.util.closeable.SequentialCloseable$1@1b3126aa)
signal close complete immediately=true
```
### Other information
Local Windows 10 with Apache Mina SSHD 2.13.1
Server - RHEL 9.2 - openssh-8.7p1-30.el9_2.3.x86_64 -
openssh-server-8.7p1-30.el9_2.3.x86_64
Java 8 Runtime Environment (for the client)
--
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]