[ https://issues.apache.org/jira/browse/SSHD-1281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17572924#comment-17572924 ]
dgü commented on SSHD-1281: --------------------------- Hello! isn't it better to focus on session termination rather than authentication ? Because, there is no connected session to authenticate. To simplify and narrow down the problem, I removed printing debug lines and authentication line. Now, it's just 1 line SSHD calls: {code:java} ClientSession clientSession = SSH_CLIENT.connect(pURI.toString()).verify().getSession(); //Sleep to see connection termination in the log before application exits. Thread.sleep(30*1000); {code} And, its log from Bitvise SSH Server log file: {quote} <event seq="89" time="2022-07-29 14:07:39.593822 +0300" app="BvSshServer 9.23" type="Info" name="I_CONNECT_ACCEPTED" desc="Connection accepted."> <conn id="1002" service="SSH" remoteAddress="127.0.0.1:60044"/> <parameters addressRule="AnyIP" listenAddress="127.0.0.1:22"/> <conns ssh="1" sshAuth="0" ftp="0" ftpAuth="0" nrWinSes="3"/> </event> <event seq="90" time="2022-07-29 14:07:39.908120 +0300" app="BvSshServer 9.23" type="Info" name="I_CONNECT_VERSION_RECEIVED" desc="Client version string received."> <conn id="1002" service="SSH" remoteAddress="127.0.0.1:60044"/> <parameters clientVersion="SSH-2.0-APACHE-SSHD-2.9.0"/> </event> <event seq="91" time="2022-07-29 14:07:39.908170 +0300" app="BvSshServer 9.23" type="Trace" name="T_CONNECT_CLIENT_VERSION_RULE_ASSIGNED" desc="The client version rule effective for this connection."> <conn id="1002" service="SSH" remoteAddress="127.0.0.1:60044"/> <versionRule matchAll="true" accept="true" allowPasswordAuth="true" allowPwKbdiAuth="true" allowGssApiAuth="true" sshUserMustMatchGssApi="true" globalRequests="AutoDetect"/> </event> <event seq="92" time="2022-07-29 14:07:39.908197 +0300" app="BvSshServer 9.23" type="Trace" name="T_SSH_SSH_GLOBAL_REQUESTS_STATUS" desc="Whether to enable sending of SSH global requests."> <conn id="1002" service="SSH" remoteAddress="127.0.0.1:60044"/> <parameters globalRequests="Unsupported"/> </event> <event seq="93" time="2022-07-29 14:07:39.908325 +0300" app="BvSshServer 9.23" type="Trace" name="T_SSH_KEY_EXCHANGE_EVENT" desc="Key exchange event."> <conn id="1002" service="SSH" remoteAddress="127.0.0.1:60044"/> <parameters eventType="Start" kexTriggerType="First" kexNr="1"/> </event> <event seq="94" time="2022-07-29 14:07:39.926677 +0300" app="BvSshServer 9.23" type="Info" name="I_CONNECT_DISCONNECTED_NORMALLY" desc="Connection disconnected normally."> <conn id="1002" service="SSH" remoteAddress="127.0.0.1:60044"/> <parameters reason="Socket" socketBytesReceived="899" socketBytesSent="1116" payloadBytesReceived="857" payloadBytesSent="923" channelBytesReceived="0" channelBytesSent="0"/> <result type="Flow" component="SshManager/socketReader" class="WinApi" *{color:#de350b}code="10054"{color}* message="Varolan bir bağlantı uzaktaki bir ana bilgisayar tarafından zorla kapatıldı." description="FlowSocketReader: Error receiving bytes"/> <conns ssh="0" sshAuth="0" ftp="0" ftpAuth="0" nrWinSes="3"/> </event> </log> {quote} As seen from the log above, Windows error code is "10054". {quote}{*}WSAECONNRESET{*}10054 Connection reset by peer.An existing connection was forcibly closed by the remote host. {quote} Ref: [https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2] It's clear that connection is terminated. I don't know the reason. It may be caused by the firewall, Bitvise SSH Server, Apacle SSHD. Anyway, SSHD should catch the connection termination and throw an exception. > ClientSession.auth().verify() is terminated with timeout > -------------------------------------------------------- > > Key: SSHD-1281 > URL: https://issues.apache.org/jira/browse/SSHD-1281 > Project: MINA SSHD > Issue Type: Bug > Affects Versions: 2.9.0 > Environment: Java SE 8, Apache NetBeans IDE 12.5, Bitvise SSH Server > 9.23 > Reporter: dgü > Priority: Major > Attachments: SSHD-NoTimeout-2.8.9.PNG, SSHDTimeout.PNG, > screenshot-1.png, screenshot-2.png, screenshot-3.png > > > Hello! > The following code works successfully in SSHD 2.8.0; but it fails in SSHD > 2.9.0: > {code:java} > final ClientSession clientSession = > SSH_CLIENT.connect(pURI.toString()).verify().getSession(); > System.out.println("clientSession.getSessionState(): " + > clientSession.getSessionState()); > System.out.println("clientSession.isClosed() : " + > clientSession.isClosed()); > System.out.println("clientSession.isClosing() : " + > clientSession.isClosing()); > System.out.println("clientSession.isOpen() : " + > clientSession.isOpen()); > System.out.println("before addPasswordIdentity: " + new > Date(System.currentTimeMillis())); > clientSession.addPasswordIdentity("deneme123"); > try { > Thread.sleep(3000); > } catch (InterruptedException ex) { > > Logger.getLogger(UBSSHDProcessProvider.class.getName()).log(Level.SEVERE, > null, ex); > } > System.out.println("clientSession.getSessionState(): " + > clientSession.getSessionState()); > System.out.println("clientSession.isClosed() : " + > clientSession.isClosed()); > System.out.println("clientSession.isClosing() : " + > clientSession.isClosing()); > System.out.println("clientSession.isOpen() : " + > clientSession.isOpen()); > System.out.println("before auth().verify(): " + new > Date(System.currentTimeMillis())); > clientSession.auth().verify(); > {code} > The output and exception: > {quote}Tem 27, 2022 11:50:19 PM > org.apache.sshd.common.io.DefaultIoServiceFactoryFactory getIoServiceProvider > INFO: No detected/configured IoServiceFactoryFactory using > Nio2ServiceFactoryFactory > clientSession.getSessionState(): [] > clientSession.isClosed() : false > clientSession.isClosing() : false > clientSession.isOpen() : true > before addPasswordIdentity: Wed Jul 27 23:50:19 EET 2022 > clientSession.getSessionState(): [] > clientSession.isClosed() : false > clientSession.isClosing() : false > clientSession.isOpen() : true > before auth().verify(): Wed Jul 27 23:50:22 EET 2022 > Tem 27, 2022 11:52:20 PM org.apache.sshd.common.session.helpers.SessionHelper > disconnect > INFO: Disconnecting(ClientSessionImpl[deneme@/127.0.0.1:22]): > SSH2_DISCONNECT_PROTOCOL_ERROR - Detected AuthTimeout after 120687/120000 ms. > Exception in thread "main" org.apache.sshd.common.SshException: Session is > being closed > at > org.apache.sshd.common.future.AbstractSshFuture.verifyResult(AbstractSshFuture.java:127) > at > org.apache.sshd.client.future.DefaultAuthFuture.verify(DefaultAuthFuture.java:39) > at > org.apache.sshd.client.future.DefaultAuthFuture.verify(DefaultAuthFuture.java:32) > at > org.apache.sshd.common.future.VerifiableFuture.verify(VerifiableFuture.java:43) > at > com.ubtools.ubutils.system.impl.UBSSHDProcessProvider.getServiceConnection(UBSSHDProcessProvider.java:85) > at > com.ubtools.ubutils.system.impl.UBSSHDProcessProvider.getServiceConnection(UBSSHDProcessProvider.java:19) > at > com.ubtools.ubutils.service.UBServiceManager.getServiceConnection(UBServiceManager.java:135) > at com.ubtools.ubutils.UBExec.main(UBExec.java:33) > Caused by: org.apache.sshd.common.SshException: Session is being closed > at > org.apache.sshd.client.session.ClientSessionImpl.preClose(ClientSessionImpl.java:169) > at > org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:94) > at > org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.sessionClosed(AbstractSessionIoHandler.java:46) > at > org.apache.sshd.common.io.nio2.Nio2Session.doCloseImmediately(Nio2Session.java:283) > at > org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:95) > at > org.apache.sshd.common.io.nio2.Nio2Session.exceptionCaught(Nio2Session.java:215) > at > org.apache.sshd.common.io.nio2.Nio2Session.handleWriteCycleFailure(Nio2Session.java:548) > at org.apache.sshd.common.io.nio2.Nio2Session$2.onFailed(Nio2Session.java:506) > at > org.apache.sshd.common.io.nio2.Nio2CompletionHandler.lambda$failed$1(Nio2CompletionHandler.java:46) > at java.security.AccessController.doPrivileged(Native Method) > at > org.apache.sshd.common.io.nio2.Nio2CompletionHandler.failed(Nio2CompletionHandler.java:45) > at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:128) > at sun.nio.ch.Invoker$2.run(Invoker.java:218) > at > sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at java.lang.Thread.run(Thread.java:748) > C:\Users\dunal\AppData\Local\NetBeans\Cache\12.5\executor-snippets\run.xml:111: > The following error occurred while executing this line: > C:\Users\dunal\AppData\Local\NetBeans\Cache\12.5\executor-snippets\run.xml:94: > Java returned: 1 > BUILD FAILED (total time: 2 minutes 2 seconds) > {quote} > The attached Bitvise SSH Server shows that the connection has ended at > 23:50.19, which is immediately after > {_}SSH_CLIENT.connect(pURI.toString()).verify().getSession(){_}. > I added _Thread.sleep(3000)_ to see if _ClientSession_ state changes. After 3 > seconds sleep, client session is still open. But, > _clientSession.auth().verify()_ is terminated with timeout after 2 minutes. > -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org