I really don't know.  Let me clarify the issue.  Specifically, this is what
I'm seeing.  On SSH_MSG_CHANNEL_OPEN TcpipServerChannel.doInit(Buffer) will
call org.apache.sshd.common.io.IoServiceFactory.createConnector().  In the
MinaServiceFactory implementation of createConnector() and createAcceptor()
it will internally create a org.apache.mina.core.service.IoConnector or
org.apache.mina.core.service.IoAcceptor but it does not pass in an executor
so org.apache.mina.core.service.AbstractIoAcceptor will create a new
executor.

The net effect of this is that with each SSH_MSG_CHANNEL_OPEN on
TcpipServerChannel two thread pools are created.  If you use
Client.startRemotePortForwarding() and then repeatedly connect to the
remote socket you will end up with a lot of thread pools.

To work around this issue I created my own SSHD IoServiceFactory to pass in
the Executor [1] [2] [3].  I believe this is working fine, but I'm now
having a different issue with leaking sockets which I'll address on a
different thread.

Darren

[1]
https://github.com/ibuildthecloud/dstack/blob/wip-b/code/implementation/agent-connection-ssh/src/main/java/io/github/ibuildthecloud/agent/connection/ssh/connection/SharedExecutorMinaServiceServiceFactory.java
[2]
https://github.com/ibuildthecloud/dstack/blob/wip-b/code/implementation/agent-connection-ssh/src/main/java/io/github/ibuildthecloud/agent/connection/ssh/connection/SharedExecutorMinaAcceptor.java
[3]
https://github.com/ibuildthecloud/dstack/blob/wip-b/code/implementation/agent-connection-ssh/src/main/java/io/github/ibuildthecloud/agent/connection/ssh/connection/SharedExecutorMinaAcceptor.java




On Fri, Jan 31, 2014 at 12:43 AM, Emmanuel Lecharny <elecha...@apache.org>wrote:

> Are you using an executor in your filter chain ?
> Le 30 janv. 2014 22:18, "Darren Shepherd" <darren.s.sheph...@gmail.com> a
> écrit :
>
> > I'm trying to use remote port forwarding.  What I'm noticing is that
> > for each TCP connection made to the remote port a new
> > Nio2Connector/MinaConnector is created which creates a new thread
> > pool.  I end with hundreds of threads by just connecting to a single
> > port every second.  Is there anyway to share a thread pool?
> >
> > Anybody else seeing this behaviour?
> >
> > Darren
> >
>

Reply via email to