tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reich, Matthias" <>
Subject Memory Leak with Comet
Date Tue, 24 Apr 2007 14:00:55 GMT

I am sorry that I did not address the memory leak issue to the users
list first, before sending this bug report:

I am aware of the fact that memory allocation occurs in Java progams,
and that Tomcat will exploit some resource pools before resources are
I am afraid that I did not consider that I should have been more
explicit in my description.

If memory allocation of Tomcat continues until I see messages like

org.apache.coyote.http11.Http11NioProcessor: Error processing request
java.lang.OutOfMemoryError: Java heap space

when I run my simple test webapp with JAVA_OPTS=-Xmx512m, this looks for
me as if there is a memory leak.

Surely, the memory leak could be in my Servlet, and the queue which
holds events until they are answered asynchronously is the first
candidate to look at in more detail.
For this reason, the Servlet logs the size of the queue whenever an
element is removed from the queue.
I saw that the queue size did not increase over the time, but memory
consumption of Tomcat did.

Therefore, I am pretty sure that there is either a memory leak in Tomcat
or I still don't understand how the Comet interfaces shall be used.

If I modify the index page of my webapp in a way that it sends only
requests to the 'traditional' servlet, memory does not increase.
Also, if it sends requests to the Comet servlet which are answered
synchronously, memory consumption is stable.
Only if comet requests are answered asynchronously,  memory does

I did not always wait until I saw the OutOfMemoryError, but the effect
is reproducible on my machine.

Any opinions about this?

Matthias Reich

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message