Hey Trustin,

I noticed many times (specially when behind a NAT device) that sometimes when a 
socket connection was lost/closed it's like the TCP layer does not inform the 
JVM about the event. So the JVM thinks that the socket is fine and even after 
writing some data (before the write queue gets full) the JVM will not get any 
IO exception so it will still think that the socket is alive. The only 
workarounds we applied (at the application level) were 1) add heartbeats that 
will eventually (hopefully) will fill up the write queue and get an IO 
exception or 2) close socket that have not "sent" any data to the server. I 
think that #1 is not 100% safe so #2 will eventually close the "assumed" dead 
connection.

Regards,

  -- Gato

----- Original Message -----
From: "Trustin Lee" <[EMAIL PROTECTED]>
To: dev@mina.apache.org
Sent: Friday, July 27, 2007 10:11:14 AM (GMT-0800) America/Los_Angeles
Subject: Re: Out Of Memory Problem Again

On 7/28/07, mat <[EMAIL PROTECTED]> wrote:
> After further research, I found out if one client disconnection was not
> caught and session.write() kept got called. Which causes the OOM? Is that
> possible?

Yes.  You have to make sure if the connection is alive and write
operation was successful.  You can check if the connection is alive by
calling IoSession.isClosing(), and WriteFuture.isWritten() for write
operations.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to