• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.OutOfMemoryError

 
vb krishna
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am on a RH Linux AS 2.1 box,
working with Apache 1.3.27 configured with SSL, tomcat 3.2.4
and jdk 1.4
When I load test the web application we have here with concurrent users working away at it, over a period of time, i get the following errors on the tomcat console.
1. IllegalStateException in huge numbers
2. java.lang.OutOfMemoryError errors
Subsequently, tomcat gets shutdown displaying the following messages.
2003-06-21 19:10:17 - ContextManager: Error reading request, ignored - java.lang.OutOfMemoryError
<<no stack trace available>>
2003-06-21 19:10:17 - PoolTcpEndpoint: Endpoint ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=8080] shutdown due to exception: java.lang.OutOfMemoryError - java.lang.OutOfMemoryError
<<no stack trace available>>
What could be the problem? Could the application be having any memory leaks? Could someone give me any ideas/suggestions?
Thanks
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is given as the source of the IllegalStateException ?
Are you using servlets and JSP or what?
JSP can throw IllegalStateException if you use forward when the output buffer has been flushed.
If it was my problem I would write a little servlet to report the current memory usage so you could see if it is using up memory gradually or all in a rush.
Bill
 
vb krishna
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response.
Servlets and JSP are being used here.
The exception line goes something like this.
2003-07-01 19:27:29 - Ctx (): IllegalStateException in: R ( /) Current State = FLUSHED, new State = CODING
I tried monitoring the memory usage while the test was in progress. It always shows a minimum of 10% unused at any given point of time and is infact constant at that usage.
There are also lots of java.lang.StackOverflowErrors shown in the console.
Any idea if it is a memory leak problem? Could it be one?
 
vb krishna
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just monitored the memory resources.
During the 10-minute sequence when a load of 25 users was on the application, the usage was shown as follows.
Swap-out rate, Swap-in rate, Page-out rate and Paging rate was almost towards the 0 on a scale of 100. Page-in rate kept changing, alternating between 0 and 25, an up followed by a down, with an average high time reaching 20. Would this data help?
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
StackOverflow errors? Sounds like one of your servlets is infinitely recursing.
 
Annekee Dufour
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, it's the illegalstateexception that is recursing.
After the illegalstate exception occurs (meaning you are trying to write something to the outputstream while it is already flushed), Tomcat tries to send an errorpage to the outputstream, which causes another illegal state exception, causing Tomcat again to try and send an errorpage to the outputstream, etc. So you get 1024 illegalstateexceptions and then a stackoverflow error.
I had this problem too (tomcat 3.2.3 jdk1.4.1). I was advised to go back to jdk 1.3 (couldn't do that) or upgrade to jdk1.4.2 (didn't help). In the end I hacked the tomcat code of the handleError method in org.apache.tomcat.core.ContextManager:
if( errorLoop( ctx, req ) || errorServlet==null){
//original code, replaced by ADU according
//to http://issues.apache.org/bugzilla/show_bug.cgi?id=19002
//errorServlet = ctx.getServletByName("tomcat.exceptionHandler");
//end original code
//start change ADU 5/11/2003
log("Error loop for " + req);
return;
//end change ADU 5/11/2003
}
That worked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic