You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Goldstein Lyor (JIRA)" <ji...@apache.org> on 2015/05/14 03:17:01 UTC
[jira] [Assigned] (SSHD-456) Nio2Acceptor does not unmanage the
session upon exception in SessionListener
[ https://issues.apache.org/jira/browse/SSHD-456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Goldstein Lyor reassigned SSHD-456:
-----------------------------------
Assignee: Goldstein Lyor
> Nio2Acceptor does not unmanage the session upon exception in SessionListener
> ----------------------------------------------------------------------------
>
> Key: SSHD-456
> URL: https://issues.apache.org/jira/browse/SSHD-456
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.14.0
> Reporter: Clement Pellerin
> Assignee: Goldstein Lyor
>
> When the sessionCreated() method of a SessionListener throws an exception the Nio2Acceptor gets confused. The IoService stops listening for new connections (socket.accept() is not called again) and the rejected session is never unmanaged.
> The bug occurs in the exception handling of Nio2Acceptor.AcceptCompletionHandler.onCompleted()
> {code}
> try {
> // Create a session
> Nio2Session session = new Nio2Session(Nio2Acceptor.this, handler, result);
> handler.sessionCreated(session);
> sessions.put(session.getId(), session);
> session.startReading();
> // Accept new connections
> socket.accept(address, this);
> } catch (Throwable exc) {
> failed(exc, address);
> }
> {code}
> Here is a sample SessionListener
> {code}
> import org.apache.sshd.common.Session;
> import org.apache.sshd.common.SessionListener;
> public class MySessionListener implements SessionListener
> {
> public void sessionCreated(Session session) {
> throw new RuntimeException();
> }
> public void sessionEvent(Session session, Event event) {
> }
> public void sessionClosed(Session session) {
> }
> }
> {code}
> Here is how to attach the SessionListener:
> {code}
> SshServer server = ...;
> SessionFactory sessionFactory = new SessionFactory();
> sessionFactory.addListener(new MySessionListener());
> server.setSessionFactory(sessionFactory);
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)