[ 
https://issues.apache.org/jira/browse/SSHD-1281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17573099#comment-17573099
 ] 

dgü commented on SSHD-1281:
---------------------------

Hello!

I got this answer from Denis Bider of Bitvise Support:
{quote}From: Bitvise Support <...>
To: ...
Sent: Friday, July 29, 2022, 08:25:24 PM GMT+3
Subject: Re: (Case 52006) SSH connection is terminated

Hello,

thank you for contacting us!

Based on the information in the Apache forum:
 - The SSH Server's textual log files show that the SSH Server is NOT 
terminating the connection.

 - The SSH Server is noticing that the incoming connection is terminated, 
either by the client or by an intermediate network component.

 - The SSH Server log files show that the connection is terminated on a TCP 
level within 0.5 seconds of when the connection is received.

On the other hand:
 - Client-side output suggests that the client is not intentionally closing the 
connection. It is unlikely, but not impossible, that the client could be 
unintentionally closing the connection without knowing what it's doing.

 - The client waits for 2 minutes before it reports an authentication timeout. 
This means that even after 2 minutes, the client is not aware that the 
connection is gone. It instead times out thinking the connection has stalled.

Based on this information, I suggest:
 - The problem could be on the client side, if a client component runs into an 
error, terminates the connection, and does not inform other components of the 
client that this has happened.

 - The problem could be with an intermediate network component. For example, 
there could be a security appliance which was configured to permit outgoing 
connections if the client version string matches APACHE-SSHD-2.8.0, but it does 
not permit the outgoing connection if the client version string is 2.9.0.

If the problem is an intermediate network component, then it's weird that it 
would send the TCP reset signal only in the server direction, but not in the 
client direction.

Since the server is detecting a TCP reset signal, but the client is not 
detecting a TCP reset and instead waits for 2 minutes, this raises the 
probability that there is an internal issue in the client software.

At the very least, if the server detects a TCP reset signal, then the client 
should also detect the TCP reset signal, and not wait for 2 minutes before 
timing out without detecting the connection was reset.

Best regards,

denis bider
Bitvise Support
{quote}
 

> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to