mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lóránt Pintér <lpin...@infomatix.hu>
Subject Lots of connections
Date Wed, 03 Oct 2007 20:21:53 GMT
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.

After expecting and diving deep into MINA, we have found that a 
BindException is raised somewhere during connection, saying something 
like 'address already in use: no further information'.

One more piece of information that seems to be important: we create a 
new SocketIoConnector each time (I know this is bad practice), so by the 
time the connection problems start to occur, we have already created a 
few thousand SocketIoConnectors already. As the local ports allocated by 
the SocketIoConnector never gets released (they show up nicely with 
netstat -a), I simply run out of available ports.

I have three questions that I'd like you to answer:

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.)

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?

3) Is there a way that I can force the SocketIoConnector to shut down 
the associated socket?

Thanks,
Lóránt

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message