Le 04/08/15 18:53, Gowtham Rupavatharam a écrit : > Sorry may be I should have elaborated > > We have a chat application and we are using *MINA* NioSocketAcceptor on the > server side to accept the TCP connections from the client. Our chat > protocol is customized XMPP
Did you have a look at Vysper, which is a full implementation of XMPP over MINA ? (http://mina.apache.org/vysper-project/index.html) > > here is the code snippet that we are using currently. > > NioSocketAcceptoracceptor = new NioSocketAcceptor(); > acceptor.setReuseAddress(true); > acceptor.getSessionConfig().setTcpNoDelay(true); > acceptor.getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 60); > > DefaultIoFilterChainBuilder chain = acceptor.getFilterChain(); > chain.addFirst("xmpp", new ProtocolCodecFilter(new XMPPCodecFactory())); > acceptor.bind(new InetSocketAddress(host, port)); > > Where XMPPCodecFactory extends DemuxingProtocolCodecFactory and has methods > for Encoding & Decoding All looks good here. > > So the server seems to be running very smooth close 2500-3000 connections > and beyond that it starts to behave weirdly and all connections get dropped > one by one and client when it tries to reconnect with the server the logs > show the MINA ioSession as 0x0000007F: nio socket, server, null => > 0.0.0.0/0.0.0.0:5222 and this connection gets closed in few seconds. > > Java server restart doesn't help and the clients on connection re-try the > server logs shows this above 0x0000007F: nio socket, server, null => > 0.0.0.0/0.0.0.0:5223. Only machine reboot fixes this. > > Usually the MINA log would be something like this (0x0000143C: nio socket, > server, /10.30.1.173:59965 => /192.168.254.67:5222) > > What I had observed was when this issue arises upon checking > > netstat | grep 5222 it shows something like this > > ip-10-63-30-252.ec:5222 [UNKNOWN]:60400 ESTABLISHED > > So not sure where exactly the problem is How many sessions are running when you encounter the pb ? (I mean, opened sessions) What does this command give ? netstat -a | grep 5222 | wc -l You should do something weid with the sessions, like not closing them... FTR, I have tested MINA with tens of million sessions for hours, and not a glitch.
