Hi Lóránt,
On 10/4/07, Lóránt Pintér <[EMAIL PROTECTED]> wrote:
> UPDATE: I seem to have gotten a bit confused here. Of course, I use only
> one SocketIoConnector, but there are different IoSessions for each
> connection. IoHandler.sessionClosed() gets called for each session, but
> the client side socket seems to never get released.
You mean there's resource leak on the client side when BindException
is raised due to running out of ephemeral ports?
> Lóránt Pintér wrote:
> > Hi!
> >
> > We have a little problem here with a stress test we'd like to do on our
> > MINA-based server. There's a test client applicaiton that tries to
> > connect to the server, execute some stuff, and then disconnect. This is
> > repeated many times on 10 different threads.
> >
> > After a few thousand of such tries all the threads start failing to
> > connect to the server, one by one.
> >
> > First, it seems that no exception is reported. The connection is done
> > like this:
> >
> >> ConnectFuture connectFuture = connector.connect(address, this,
> >> connectorConfig);
> >> connectFuture.join();
> >> if (!connectFuture.isConnected())
> >> throw new ProtocolIOException("Cannot connect to server");
> >
> > The exceptionCaught() method of the IoHandler is never caught, but
> > connectFuture.isConnected() returns false.
If the connection is not made at all, exceptionCaught it not invoked.
You can get the exception by calling ConnectFuture.getSession() or
ConnectFuture.getException() instead.
> > 1) Should I share one SocketIoConnector instance between all threads, or
> > should I open one for each serivce thread? (Please take into
> > consideration that I'm doing a stress-test, so I'd like to have the
> > 'clients' working the most similar to as if they were running on
> > different machines.)
Yes.
> > 2) Why does the BindException never get reported by
> > IoHandler.exceptionCaught()? Should I submit a bug about this, or am I
> > doing something completely wrong? Is there some other place I can catch it?
It's because it means the connection is not actually made. A session
is a connection, and we can't report any exception if there's no
session created. You can get the raised exception from ConnectFuture
alternatively, as suggested above.
> > 3) Is there a way that I can force the SocketIoConnector to shut down
> > the associated socket?
Could you explain a little bit more in detail?
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6