Thanks guys - it makes sense now and I was able to reproduce the problem :) I am now trying to decide whether to use the system defined TCP keep alives or develop our own application level keep-alives.
-Dhruv On Fri, Jan 11, 2013 at 2:41 PM, Emmanuel Lécharny <elecha...@gmail.com>wrote: > Le 1/11/13 7:00 AM, Dhruv Chopra a écrit : > > Hi, > > > > We are using Apache MINA TCP server for our gaming server product. > > Occasionally, (under no seemingly special circumstances) I see that > > when a client connection breaks - the sessionClosed event is not fired > > on my server's IoHandler. Eventually the sessoinIdle event comes and > > we have added logic to terminate the IoSession there. This behavior is > > observed rarely (say for less than 1% of the connections). > > > > I am wondering if someone else has also observed this? Or anyone have > > any suggestions on how I can debug this further from my end. We are > > still using MINA 2.0.4 - any bug fixes in the further releases that > > might have fixed this behavior? > > This is a plain normal situation. It hppens rarely, because users > generally quit their applications, instead of unpluging their cable from > the network socket. > > You can reproduce this cas very easily: connect a client computer to > your application, and just unplug the network cable. The server won't > notice the disconnection. > > This is btw why the Idle state is good for, so you are doing everything > ok if you are using this event. > > Otherwise, the disconnection will be dectected when the keepalive will > detect that the socket is dead (see > http://tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/#whatis) > > The default delay for Keepalive is 2 hours on a linux box. > > -- > Regards, > Cordialement, > Emmanuel Lécharny > www.iktek.com > >