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

Goldstein Lyor commented on SSHD-625:
-------------------------------------

What you describe seems a bit strange since the _IoSession_ object 
implementation through which messages are being processed contains a special 
_catch(Throwable t)_ clause that invokes _AbstractSession#exceptionCaught_ so 
please review your log. In any case, you have a point to some extent - please 
note though that problems such as OOM or stack overflow are so serious that 
even logging might not be possible (because you are out-of-memory or stack...). 
Specifically for the error going straight to the JVM internals, look into 
_Thread.setUncaughtExceptionHandler_ as well as using a dedicated _ThreadGroup_ 
to handle and log such problems. Catching _Throwable_(s) can only go so far and 
it won't help 100% of the time. I will look into the code and try to see where 
we can substitute
{code:java}
catch(Exception e)
{code}
with
{code:java}
catch(Throwable t)
{code}

> Use catch(Throwable) where possible to avoid stopping performing queries and 
> to log errors
> ------------------------------------------------------------------------------------------
>
>                 Key: SSHD-625
>                 URL: https://issues.apache.org/jira/browse/SSHD-625
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Eugene Petrenko
>
> There are several places in library source where you catch Exception to log 
> it. Not Throwable. But it may easily turn out any some Error is thrown from 
> user provided implementations.
> Here is incorrect catch: * 
> org.apache.sshd.server.config.keys.AuthorizedKeysAuthenticator#authenticate
> There is no catch at all in 
> * org.apache.sshd.server.auth.UserAuthKeyboardInteractive#doAuth
> * org.apache.sshd.server.channel.ChannelSession#handleRequest
> The problem is that once my code throws a Error (e.g. VerifyError or OOM) the 
> error goes strait into JVM internals without being explicitly logged. As a 
> side effect of that SSHD server stops functioning. Connections are accepted 
> but not being processed.
> My current workaround is to explicitly wrap all classes I implement with 
> try/catch. I believe it should be done inside the library to avoid everyone 
> from writing similar try-catch. I believe it's OK to forcibly close any 
> connection once exception was caught and logged



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to