Tomcat OutOfMemory problem in operational mode

If you think that something doesn't work in Aware IM post your message here
Post Reply
greg
Posts: 124
Joined: Sat Apr 23, 2005 12:46 am

Tomcat OutOfMemory problem in operational mode

Post by greg »

I experienced the following problem while switching between some tabs on some forms in operational mode while other tabs and forms were performing normally.

Code: Select all

HTTP Status 500 -

type Exception report

message description The server encountered an internal error () that prevented it from fulfilling this request.

exception
javax.servlet.ServletException: Servlet execution threw an exception

root cause
java.lang.OutOfMemoryError

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
Apache Tomcat/5.0.28
It seems that it is related to Tomcat memory allocation. How can I prevent this from occurring?
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Tomcat can run out of memory if there are two many concurrent users. This may also happen if timeout for Tomcat sessions is set to some large value or it doesn't time out at all. In this case memory for all users that forget to log out after using the system will never be released, which will eventually cause "Out of memory" error.

There are 2 ways to address it:
1) Make the timeout of a Tomcat session smaller. This is controlled in the webapp.props file located in AwareIMRoot/Tomcat/webapps/AwareIM directory. Change the following line:
SessionTimeout=1800
The value is in seconds - 1800 is half an hour.

2) Change the startup settings of Tomcat to increase the amount of memory it uses. This can be done in a file called startupOptions.props. There is a sample of such a file in the SAMPLES directory. If you put this file in the BIN directory Aware IM will use it on startup. To increase the memory used by Tomcat modify the following line:

TOMCAT_STARTUP=..\\JDK\\bin\\java -Xmx256m -Xms20m -Djava.endorsed.dirs=../Tomcat/common/endorsed -classpath ../JDK/lib/tools.jar;../Tomcat/bin/bootstrap.jar -Dcatalina.base=../Tomcat -Dcatalina.home=../Tomcat -Djava.io.tmpdir=../Tomcat/temp org.apache.catalina.startup.Bootstrap start

Note -Xmx256m - this allocates 256M of memory to Tomcat. You can make it even bigger if you like.
Aware IM Support Team
greg
Posts: 124
Joined: Sat Apr 23, 2005 12:46 am

Post by greg »

Do I need to do this every time I install a new AwareIM update?
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Yes, for now.
Aware IM Support Team
ab042
Posts: 326
Joined: Mon Jul 17, 2006 4:11 am

Post by ab042 »

I noticed this file doesn't appear to have the above changes in it and its not in the bin directory.

Is the above still and issue and should we be modifing this or other files if you have a larger user base with heavy use?
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

This file is in SAMPLES directory initially. If you put this file into BIN directory Aware IM will start using it. Otherwise it uses the default startup options (which are the same options that you find in the original file that resides in the SAMPLES directory).

So if you want to change the startup settings you need to modify this file and place it in the BIN directory.

As far as Tomcat is concerned, yes, we do recommend increasing the memory if you expect large amount of concurrent users (provided that your server has enough free memory)
Aware IM Support Team
john
Posts: 113
Joined: Tue Jul 25, 2006 10:48 am
Location: UK

Post by john »

Hi

I have recently started to be affected by this problem. I have followed the above instructions to the letter and its no better.

I have noticed the operation mode does seem to run very slow anyway. I wasn't sure if it was just me being a bit picky but sine this memory problem is starting to occur (everyday at some point) it has brought it further to my attention.

Our server is on Windows 2k Pro and has 512 RAM. I know this is more than enough, especially when I am only testing my data (in early design stages) so I have very little actually in the system.

Are there any other known fixes or hints you can give me to get my system up to speed?

Many Thanks
John
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

So what is exactly happenning on your machine?

Is Tomcat running out of memory? Have you checked its output to verify that?

Or is your complaint about speed?
Aware IM Support Team
john
Posts: 113
Joined: Tue Jul 25, 2006 10:48 am
Location: UK

Post by john »

Hi

It wasn't really a complaint I am just eager to get the software running? I joined this feed because the error I am getting is very similar to the one above

Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:244)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.OutOfMemoryError


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

I have had a look at the logs (where I think they are) but it doesn't really tell me much. This has happened before but a couple of hours later it was ok again. This time however I have come in the next day and it is still the same.

Could you point me in the right direction for the logs I should be looking at so I can pass the information onto you. So far I have looked in the AwareIM\Tomcat\logs and found today's file and it says the same thing.

If your question was about the server PC, it doesnt really get used for anything else at the moment but it appears to be running ok

Thanks
John
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

First of all please check the amount of free memory that your server has (there may be some hidden services running there that are eating up memory). There must be at least 256M for Aware IM to run properly.

(we have just had a complaint from a customer who was saying that his server had 1Gb of memory, but when he checked for free memory it turned out that his server only had less than 100M available).

Next step is to increase memory allocated to Tomcat in the startupOptions.props file as explained in this thread and also in the Installation Guide. Have you tried that? Try to increase memory further and further (don't forget to re-start Aware IM). If this doesn't help there MUST be lack of physical memory on your server.
Aware IM Support Team
john
Posts: 113
Joined: Tue Jul 25, 2006 10:48 am
Location: UK

Post by john »

Hi

Thanks for that, I will have a look. Just a quick question on this. The code -Xmx256m -Xms20m states the maximum and starting values of the memory alocated (correct me if im wrong). Does the starting value Xms20m have any affect?

Thanks
John
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Not really. It's the -Xmx that makes all the difference. There are separate settings for Aware IM server (in startAwareIM.bat), Tomcat and JBoss (in startupOptions.props)
Aware IM Support Team
Post Reply