tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dhruva B. Reddy" <>
Subject OutOfMemoryError with Seemingly Plenty of Memory
Date Mon, 26 Jan 2004 23:07:33 GMT
I am troubleshooting an issue we've been having with Tomcat 4.1.27.  We
have several websites on one instance, and it regularly throws an
OutOfMemoryError, requiring a restart of Tomcat.

Some observations (warning--this is a bit long):

* The box runs two 2.8GHz Pentium 4 Hyperthreaded Xeons, and has 2GB of
RAM (recently upgraded from 1GB).
* The OutOfMemoryError never contains a message (I believe an
OutOfMemoryError is thrown with a message when the java process has
used the maximum number of threads).
* There is a single instance of Tomcat, housing 20 applications
(including the ones that come with the standard distribution of Tomcat,
examples, tomcat-docs, etc.--these apps see no traffic).
* We have a servlet that is hit every five minutes.  It calls
Runtime.freeMemory(), Runtime.totalMemory() and Runtime.maxMemory(),
after calling Runtime.gc(). This information is graphed (free, total -
free, both vs. time).  According to this graph, there is always plenty
of memory available (I have seen the amount of free memory get quite
low--below 1MB, but never when the problem occurs).
* We're running Tomcat 4.1.27, Redhat Linux 7.3, Sun JDK 1.4.1_05.
* Peak traffic is between 10:00 and 22:00 everyday.  The heaviest day
is Monday and the lightest Saturday.
* Together, the applications service an average of 1600+ requests per
* Before the memory upgrade, we were running an initial heap size of
100MB, and max of 768MB.  We are now running an initial heap size of
768MB and max of 1536MB.
* Uptime used to be about 100 hours, but recently has fallen to 24
hours.  This change does not coincide with any configuration change.  I
have not determined if there is a coincident change in traffic
patterns.  The memory upgrade has had no effect on uptime.
* Before the memory upgrade, when the problem occurred I would find the
java process spinning (i.e., processor use according to top was 99%),
and it appeared to be using some swap space.  Since the memory upgrade,
no swap space has been used, and the spinning has not been observed.
* At the time that the problem occurs, top reports that java is using
500-600MB of RAM.  This has not changed since the memory upgrade.
* Tomcat is set up not to refresh the context automatically.  Although
it is set up to refresh JSPs, we do not do this.  No changes are ever
made without restarting Tomcat.
* We have the JSP compiler set up to fork (i.e., use another instance
of the JVM).
* The problem almost always occurs during hours of heavy use, although
it has also been observed on Saturdays (the day of lightest use).
* Diskspace use is nowhere near capacity. 
* For a few days, we ran Tomcat with verbose garbage collection (the
"verbose:gc" flag).  The problem seemed to occur just after a "full"
garbage collection.

Although the possibility of a memory leak (sorry--unintended object
retention) has not been completely ruled out (yes, I'm running the
applications through a profiler), I'm quite puzzled that this problem
would occur when, by all indications, memory use is nowhere near the

Any insights or other things to look at would be greatly appreciated.


Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message