In sessionClosed() method in DefaultIoFilterChain, it will do:

s.getWriteRequestQueue().dispose(session);


There are only two classes that implements WriteRequestQueue, one is 
CloseAwareWriteQueue and another is DefaultWriteRequestQueue. 
CloseAwareWriteQueue is just a wrapper on top of DefaultWriteRequestQueue where 
the dispose() method does nothing.
 
  public void dispose(IoSession session) {
  }


So I have a theory for the mem leak:

1: Client request something,
2: Server fetch the data and call session.write(), the data got queued in the 
wirteRequestQueue.
3: Before the data got actually flushed, the client drops the connection
4: MINA fires sessionClosed() as expect, but the dispose method didn't actually 
clear the queue.
5: Because of the session still got referenced by the Finalizer, the huge 
amount of data just hang around.


Am I right that the dispose() method should clear the queue?

Thanks,
Yong




-----Original Message-----
From: Yongxing Wang 
Sent: Thursday, May 14, 2009 9:31 AM
To: '[email protected]'
Subject: RE: memory leak? -- help needed

Yes, I will definitely run it against one of those tools (my Jprofile 
evaluation expired, need to work it out). 

I guess last night my brain was fried and I didn't provide enough information. 
The dump analysis told me that there are still more than 7K NioSocketSession 
(referenced by java.lang.Finalizer) hanging around three hours after I the 
process out of LB. This probably related to one of my earlier post:

"Looking at the source code, it is caused by DefaultIoFilterChain (because it 
has a finalize method)." -- the chain holds a reference to the session.

I tried to trace the "DefaultWriteFuture" to the GC root. With 10G of dump 
data, the query never returns.

I will continue to do more analysis. At the mean time, is there a reason that 
you have to use "finalize" method in the DefaultIoFilterChain? 

Yong


-----Original Message-----
From: Emmanuel Lecharny [mailto:[email protected]] On Behalf Of Emmanuel 
Lecharny
Sent: Wednesday, May 13, 2009 11:47 PM
To: [email protected]
Subject: Re: memory leak? -- help needed

Yongxing Wang wrote:
> Gurus,
>   
hi,

you should use a tool to determine if the memory leak you are 
experiencing is part of your own code. You have plenty of them out there 
: JProfiler, OptimizeIt, YourKit, ...

This will give you some insight about the part of the code where this 
memory leak is likely to be created.

There is not much we can do with the provided information atm...

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to