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
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
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
Any help would be appreciated
Thanks,
Gowtham
On Tue, Aug 4, 2015 at 9:55 PM, Emmanuel Lécharny <[email protected]>
wrote:
> Le 04/08/15 18:08, Gowtham Rupavatharam a écrit :
> > Hello Mina Dev,
> > We use Apache MINA for TCP socket connections
> > on our servers. After around close to 3000 TCP connections, the MINA
> > IoSession resolve the remote IP as NULL and client IP as 0.0.0.0:5222
> and
> > this connections are never fully-connected connections and they get
> closed
> > and this cycle keeps repeating.
> >
> > It would show up something like this - 0x0000007F: nio socket, server,
> null
> > => 0.0.0.0/0.0.0.0:5223
> >
> > Unless the machine is rebooted there is no way to recover from this
> > situation. Can you please let me know why does this happen and how to
> > recover from this
> We can't tell with such a description.
>
> You need to tell us how you are using MINA to give us some clue about
> what could go wrong.
>
>