mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SSHD-786) Clients can't authenticate after unexpected exception in Nio2Acceptor
Date Wed, 06 Dec 2017 09:39:00 GMT

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

Guillaume Nodet commented on SSHD-786:
--------------------------------------

Since the exception mentions {{org.apache.sshd.common.io.nio2.Nio2Acceptor}}, I don't think
the mina library is being used in this case.

Isn't the problem simply because when an exception is caught and the callback called, no {{accept}}
is done ?

What about the following patch:
{code}
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2Acceptor.java b/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2Acceptor.java
index e942e8ab..131f318d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2Acceptor.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2Acceptor.java
@@ -205,11 +205,20 @@ public class Nio2Acceptor extends Nio2Service implements IoAcceptor
{
         @Override
         @SuppressWarnings("synthetic-access")
         protected void onFailed(final Throwable exc, final SocketAddress address) {
-            if (channels.containsKey(address) && !disposing.get()) {
-                log.warn("Caught " + exc.getClass().getSimpleName()
-                       + " while accepting incoming connection from " + address
-                       + ": " + exc.getMessage(),
-                        exc);
+            if (!disposing.get()) {
+                if (channels.containsKey(address)) {
+                    log.warn("Caught " + exc.getClass().getSimpleName()
+                                    + " while accepting incoming connection from " + address
+                                    + ": " + exc.getMessage(),
+                            exc);
+                }
+
+                try {
+                    // Accept new connections
+                    socket.accept(address, this);
+                } catch (Throwable exc2) {
+                    failed(exc2, address);
+                }
             }
         }
     }
{code}

> Clients can't authenticate after unexpected exception in Nio2Acceptor
> ---------------------------------------------------------------------
>
>                 Key: SSHD-786
>                 URL: https://issues.apache.org/jira/browse/SSHD-786
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 1.2.0, 1.3.0, 1.4.0, 1.6.0
>         Environment: Windows
>            Reporter: masc
>
> {code}
> 2017-11-28 15:26:54,808 11566202 sshd-SshServer[434a2a10]-nio2-thread-4 org.apache.sshd.common.io.nio2.Nio2Acceptor
WARN - Caught IOException while accepting incoming connection from /0:0:0:0:0:0:0:0:13003:
The specified network name is no longer available.
> java.io.IOException: The specified network name is no longer available.
> 	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:748)
> {code}
> As soon as this exception occurs once, clients can still connect but will fail to authenticate.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message