tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jost Richstein <>
Subject Re: Tomcat JVM using 99.9% cpu
Date Fri, 23 Sep 2005 07:50:54 GMT
For more information see:

Ingo Rockel wrote:

> Hi Jost,
> do you have any bug numbers concerning the OOM-issue with String.trim() 
> and substring at hand?
> cheers,
> Ingo
> Jost Richstein schrieb:
>> Most likely the garbage collector causes your CPU load.
>> At some point there is not enough memory and the collector tries
>> to free some of it and tries and tries and tries. Usually your
>> server runs fine even with this CPU load, it even sends quick
>> responses (the collector has a low priority), but it results
>> sooner or later in an "out of memory" exception.
>> We had the same problem and the solution was not so obvious
>> (for me at least). The memory leak we experienced was a
>> String.substring() and String.trim() problem. These methodes
>> do not create new Strings instead they point into the underlying
>> char-array of the original String. The consequence is that the
>> original string can not be freed until all substrings and trims
>> are freed. If you are using caches, static strings - check this.
>> And, by the way: all is fine if you are using
>> new String(str.substring()). It is well documented in the bug
>> parade.
>> Azariah Jeyakumar wrote:
>>> Hi,
>>> Has anyone seen Tomcat JVM using 99.9% cpu when there is no HTTP load 
>>> at all? The JSP pages are accessible fine without any loss in 
>>> functionality, but the machine is sluggish (expectedly, as the JVM is 
>>> using all the CPU). If tomcat is restarted, the problem goes away and 
>>> the CPU usage returns to normal.
>>> I have not been able to reproduce the problem at will. It has been 
>>> noticed only twice or so in the past week, out of hundreds of attempts.
>>> I have seen other posts asking to tweak the settings like socket_* in 
>>> files. But since I have not been able to reproduce 
>>> the problem at will, I am hesitant to change the parameters, not 
>>> knowing which change will fix the problem.
>>> Thanks for any input or pointers on:
>>> - the nature of the problem that causes this 99.9% CPU usage
>>> - how to reproduce the problem
>>> - what parameters should be set in file or 
>>> elsewhere to avoid this problem in the future.
>>> I am using Tomcat 5.0.28, Apache 2.x, jk2, Sun JRE 1.4.2_08  on Suse 
>>> Linux Enterprise Server (SLES 9 SP2).
>>> Thanks
>>> Azariah
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

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

View raw message