tomcat-users mailing list archives

While working towards resolving the 'tomcat crashing issue' quite a few
things came to light for me;
1. I wrote a small client app. to stress test the server app. This app
creates 5 to 10 threads and sends http requests to the server app.
I realized that the tomcat was crashing because there were just too many
requests and the threads which tomcat creates were insufficient to handle
them and eventually the tomcat would crash (apart from that my jsp-bean
app hogs lot of memory).
2. I overcome this problem by adopting 2 techniques discussed in this
mailing
list;
a.
I was using JDK1.2.2 I switched over to JDK 1.3.02
b.
setting thread values in the server.xml
<Parameter name="max_threads" value="200"/>
<Parameter name="max_spare_threads" value="50"/>
<Parameter name="min_spare_threads" value="20"/>
c.
setting following for the JVM
TOMCAT_OPTS (e.g. -Xmx256m -Xms128m).
(Well I did not have time to try which of the above 3 helps more)
Now the crash is gone (which was very predictable and frequent) I have
following observations;
1. I am using xalan and xerces in my server application; With every request
sent to the server, the server app does lot of xml processing;
This makes tomcat threads to create lot of java objects and those are not
getting free immediately. Infact with every request the memory utilized by
the threads go on increasing;
When I execute TOP command on linux, it shows 60 java threads which start
with 10MB and reach upto 120Mb
I have 512MB RAM on my system This eventually gets exhausted and then it
starts using the swap files.
2.
Then I wrote a simple JSP file ; which connects to mysql database and
performs simple sql query. (No XML)
This kind of request too seems to hog lot of memory
3. I wrote simple java processing in JSP and used this JSP for stress
testing; This did not hog memory at all.
4. Then I wrote simple XSL transformation code in JSP as follows
<%
String path = "file:///" + request.getRealPath("/") + "test/";
String xmlfile = path+"1.xml";
String xslfile = path+"1.xsl";
javax.xml.transform.TransformerFactory tFactory =
javax.xml.transform.TransformerFactory.newInstance();
javax.xml.transform.Transformer transformer = tFactory.newTransformer(new
javax.xml.transform.stream.StreamSource(xslfile));
transformer.transform(new javax.xml.transform.stream.StreamSource(xmlfile),
new javax.xml.transform.stream.StreamResult(out));
%>
This also seems to hog lot of memory
In this case I have observed following scenarios;
a. after couple of hours of operation tomcat ran out of memory and I had to
restart tomcat(once I had to restart machine itself)
b. after 15 hours of operation,
the tomcat continues to run smoothly (slowed down slightly)
But in this case I observed, there was no disk space left on the disk.
Some 'kcore' file and the jasper.log grew monstrously.
I had to restart the machine.
I hope this is making any sense to anybody.
The questions arise are;
1. Why the xml processing is taking so much of the memory
2. Quite a few times I stopped the tests when the memory used by the tomcat
threads reached say from 10Mb to 40MB. The whole system is still running
fine. Even after waiting for couple of hours this memory does not seem to be
released.
If I again start the test, the memory space utilized by the threads would
start growing from 40MB onwards.
3. why does not the Garbage collector start its operation and free up some
memory.
(Well I understand that the GC may not run at all if there is still some
memory available)
-- haresh
-----Original Message-----
From: Haresh Gujarathi [mailto:gharesh@vsnl.com]
Sent: Tuesday, September 25, 2001 3:45 PM
To: Tomcat-User
Subject: tomcat is crashing
Hi,
I am running a Java application which is using Apache Xalan and Xerces 2.0.
After a while the tomcat seem crashes.
I am not attributing the crash due to xalan or xerces. But for some reason I
have suspition on it.
I could not make out head or tail of the tomcat.log . It seems to have lot
of thread related messages; like.......
org.apache.tomcat.util.ThreadPool$ControlRunnable@40EBA068/40FCE1E8:
<unowned>
Waiting to be notified:
"Thread-26" (0x8691f88)
org.apache.tomcat.util.ThreadPool$MonitorRunnable@40EBA020/40FCE610:
<unowned>
Waiting to be notified:
"Thread-33" (0x86a9658)
Then there are lot of message as .................
"Thread-3" (TID:0x40ec7aa0, sys_thread_t:0x866fea0, state:CW) prio=5
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java, Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
at java.lang.Thread.run(Thread.java, Compiled Code)
"Thread-2" (TID:0x40ec7958, sys_thread_t:0x866c740, state:CW) prio=5
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java, Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
at java.lang.Thread.run(Thread.java, Compiled Code)
"Thread-1" (TID:0x40ec7e40, sys_thread_t:0x8668b60, state:CW) prio=5
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java, Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
at java.lang.Thread.run(Thread.java, Compiled Code)
Can somebody provide any clue?
I am using Red Hat 7.1
tomcat 3.2.1
apache 1.14
JDK
1.3.0
regards
haresh
-----Original Message-----
From: Haresh Gujarathi [mailto:gharesh@vsnl.com]
Sent: Thursday, September 27, 2001 11:22 PM
To: tomcat-user@jakarta.apache.org; gharesh@vsnl.com
Subject: RE: tomcat is crashing
While working towards resolving the 'tomcat crashing issue' quite a few
things came to light for me;
1. I wrote a small client app. to stress test the server app. This app
creates 5 to 10 threads and sends http requests to the server app.
I realized that the tomcat was crasing because there were just too many
requests and the threads which tomcat creates were insufficient to handle
them and and eventually the tomcat would crash (apart from that my jsp-bean
app hogs lot of memory).
2. I overcome this problem by adopting 2 techiques discussed in this mailing
list;
a.
I was using JDK1.2.2 I switched over to JDK 1.3.02
b.
setting thread values in the server.xml
<Parameter name="max_threads" value="200"/>
<Parameter name="max_spare_threads" value="50"/>
<Parameter name="min_spare_threads" value="20"/>
c.
setting following for the JVM
TOMCAT_OPTS (e.g. -Xmx256m -Xms128m).
(Well I did not have time to try which of the above 3 helps more)
Now the crash is gone (which was very predictable and frequent) I have
following observations;
1. I am using xalan and xerces in my server application; With every request
sent to the server, the server app does lot of xml processing;
This makes tomcat threads to create lot of java objects and those are not
getting free immediately. Infact with every request the memory utilized by
the threads go on increasing;
When I execute TOP command on linux, it shows 60 java threads which start
with 10MB and reach upto 120Mb
I have 512MB RAM on my system This eventually gets exausted and then it
starts using the swap files.
2.
Then I wrote a simple JSP file ; which connects to mysql database and
performs simple sql query. (No XML)
This kind of request too seems to hog lot of memory
3. I wrote simple java processing in JSP and used this JSP for stress
testing; This did not hog memory at all.
4. Then I wrote simple XSL transofrmation code in JSP as follows
<%
String path = "file:///" + request.getRealPath("/") + "test/";
String xmlfile = path+"1.xml";
String xslfile = path+"1.xsl";
javax.xml.transform.TransformerFactory tFactory =
javax.xml.transform.TransformerFactory.newInstance();
javax.xml.transform.Transformer transformer = tFactory.newTransformer(new
javax.xml.transform.stream.StreamSource(xslfile));
transformer.transform(new javax.xml.transform.stream.StreamSource(xmlfile),
new javax.xml.transform.stream.StreamResult(out));
%>
This also seems to hog lot of memory
In this case I have observed following scenarios;
a. after couple of hours of operation tomcat ran out of memory and I had to
restart tomcat(once I had to restart machine itself)
b. after 15 houres of operation,
the tomcat continues to run smoothly (slowed down slighly)
But in this case I observed, there was no disk space left on the disk.
Some 'kcore' file and the jasper.log grew monsterously.
I had to restart the machine.
I hope this is making any sense to anybody.
The questions arise are;
1. Why the xml processing is taking so much of the memory
2. Quite a few times I stopped the tests when the memory used by the tomcat
threads reached say from 10Mb to 40MB. The whole system is still running
fine. Even after waiting for couple of hours this memory does not seem to be
released.
If I again start the test, the memory space utilized by the threads would
start growing from 40MB onwards.
3. why does not the Garbage collector start its operation and free up some
memory.
(Well I understand that the GC may not run at all if there is still some
memory available)
-- haresh
-----Original Message-----
From: Haresh Gujarathi [mailto:gharesh@vsnl.com]
Sent: Tuesday, September 25, 2001 3:45 PM
To: Tomcat-User
Subject: tomcat is crashing
Hi,
I am running a Java application which is using Apache Xalan and Xerces 2.0.
After a while the tomcat seem crashes.
I am not attributing the crash due to xalan or xerces. But for some reason I
have suspition on it.
I could not make out head or tail of the tomcat.log . It seems to have lot
of thread related messages; like.......
org.apache.tomcat.util.ThreadPool$ControlRunnable@40EBA068/40FCE1E8:
<unowned>
Waiting to be notified:
"Thread-26" (0x8691f88)
org.apache.tomcat.util.ThreadPool$MonitorRunnable@40EBA020/40FCE610:
<unowned>
Waiting to be notified:
"Thread-33" (0x86a9658)
Then there are lot of message as .................
"Thread-3" (TID:0x40ec7aa0, sys_thread_t:0x866fea0, state:CW) prio=5
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java, Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
at java.lang.Thread.run(Thread.java, Compiled Code)
"Thread-2" (TID:0x40ec7958, sys_thread_t:0x866c740, state:CW) prio=5
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java, Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
at java.lang.Thread.run(Thread.java, Compiled Code)
"Thread-1" (TID:0x40ec7e40, sys_thread_t:0x8668b60, state:CW) prio=5
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java, Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
at java.lang.Thread.run(Thread.java, Compiled Code)
Can somebody provide any clue?
I am using Red Hat 7.1
tomcat 3.2.1
apache 1.14
JDK
1.3.0
regards
haresh