tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: java.lang.OutOfMemoryError: Java heap space
Date Sun, 04 Oct 2009 20:33:25 GMT
On 04.10.2009 22:17, Joe Hansen wrote:
> I found the following error message in the Apache logs:
> [Sat Oct 03 04:10:49 2009] [error] server reached MaxClients setting,
> consider raising the MaxClients setting
> 
> Here's a snippet from the httpd.conf, which deals with MaxClients.
> <IfModule prefork.c>
> StartServers       8
> MinSpareServers    5
> MaxSpareServers   20
> ServerLimit      256
> MaxClients       256
> MaxRequestsPerChild  4000
> </IfModule>
> 
> <IfModule worker.c>
> StartServers         2
> MaxClients         150
> MinSpareThreads     25
> MaxSpareThreads     75
> ThreadsPerChild     25
> MaxRequestsPerChild  0
> </IfModule>
> 
> I will watch out for the increase in the number of httpd processes. I
> am wondering if I should raise the MaxClients value in prefork.c and
> worker.c modules. Can anyone on this forum please explain why new
> httpd processes are spawned and why aren't the old processes
> terminated?

Likely because requests get stuck (no responses are returned), so the
web server waits very long for Tomcat to produce a request and the
stream of incoming new requests fill up all available threads in the web
server. To find the reason, the thread dumps will be helpful.

Regards,

Rainer

> On Sun, Oct 4, 2009 at 1:45 PM, Joe Hansen <joe.hansen.at@gmail.com> wrote:
>> Rainer, Thank you so much for your kind reply!
>>
>> I have increased the java heap size to 512MB (-Xms512m -Xmx512m). I am
>> hoping that would fix the issue. I had configured our webserver to use
>> Jasig's Central Authentication System (CAS). Recently I increased the
>> session timeout from 30 minutes to 4 hours. I am guessing that must
>> have had an impact on the number of tickets that the CAS could store
>> in the Java's memory space.
>>
>> I did run the kill -QUIT command against the tomcat process. It did
>> generate a huge output in the catalina.out file. I am unable to
>> decipher it. I do not want to post it to the mailing list because its
>> very long. Would you be able to please tell me what should I be
>> looking for within this long thread dump?
>>
>> Thanks again, Rainer :)
>>
>> Joe
>>
>> On Sat, Oct 3, 2009 at 12:24 PM, Rainer Jung <rainer.jung@kippdata.de> wrote:
>>> On 03.10.2009 20:07, Joe Hansen wrote:
>>>> Hey All,
>>>>
>>>> I get this error (java.lang.OutOfMemoryError: Java heap space) after
>>>> my Apache 2.0/Tomcat 5.5/mod_jk installation has been up and running
>>>> for a few hours. This problem started just since two days. Never had
>>>> this issue before!
>>>>
>>>> I have also noticed that as soon as I startup the server, 9 httpd
>>>> processes start. Number of httpd processes keep on increasing until I
>>>> get the OutOfMemoryError.
>>>> $ps -aef | grep httpd
>>>> root     31984     1  0 11:23 ?        00:00:00 /usr/sbin/httpd
>>>> apache   31987 31984  0 11:23 ?        00:00:00 /usr/sbin/httpd
>>>> apache   31988 31984  0 11:23 ?        00:00:00 /usr/sbin/httpd
>>>> apache   31989 31984  0 11:23 ?        00:00:00 /usr/sbin/httpd
>>>> apache   31990 31984  0 11:23 ?        00:00:00 /usr/sbin/httpd
>>>> apache   31991 31984  0 11:23 ?        00:00:00 /usr/sbin/httpd
>>>> apache   31992 31984  0 11:23 ?        00:00:00 /usr/sbin/httpd
>>>> apache   31993 31984  0 11:23 ?        00:00:00 /usr/sbin/httpd
>>>> apache   31994 31984  0 11:23 ?        00:00:00 /usr/sbin/httpd
>>>
>>> Sounds like requests get stuck or responses are only returned very slowly.
>>>
>>> I would take thread dumps during the time requests pile up (e.g. httpd
>>> process count increases). Thread dumps are generated by "kil -QUIT"
>>> against the Tomcat process. Result is written to catalina.out. Always
>>> take afew thread dumps shortly after each other, e.g. 3 dumps each 3
>>> seconds apart from the previous one, so that you can find out, if a
>>> status in a dump is pure coincidence or lasts for somewhat longer.
>>>
>>>> $ps -aef | grep tomcat
>>>> root     31949     1 43 11:23 pts/0    00:00:58 /usr/java/jdk/bin/java -Djava.u
>>>> il.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.co
>>>> fig.file=/usr/lib/apache-tomcat/conf/logging.properties -Djava.endorsed.dirs=/u
>>>> r/lib/apache-tomcat/common/endorsed -classpath :/usr/lib/apache-tomcat/bin/boot
>>>> trap.jar:/usr/lib/apache-tomcat/bin/commons-logging-api.jar -Dcatalina.base=/us
>>>> /lib/apache-tomcat -Dcatalina.home=/usr/lib/apache-tomcat -Djava.io.tmpdir=/usr
>>>> lib/apache-tomcat/temp org.apache.catalina.startup.Bootstrap start
>>>
>>> There is no Java memory configuration included above (i.e. al defaults).
>>> It might well be, that you have to explicitely set heap size, perm size
>>> and if you like also eden and semi spaces.
>>>
>>>> Can someone on this list please help me resolve this issue.
>>>>
>>>> Thanks you,
>>>> Joe
>>>
>>> Regards,
>>>
>>> Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message