views:

76

answers:

2

Do you know how to make it more stable, maybe properties to set, memory to allocate?

It always hangs up when redeploying web apps, thru manager (wars), web interface or maven plugin.

every second time it gives PermGenSpace, no memory errors etc.

on my local machine 3gb ram.

It looks like it should be manually set up to work in a stable way.

How to fix such a problem?

+3  A: 

You need to increase the PermGenSpace, which may be too small for your needs by default. Startup Tomcat by giving this kind of switch to JVM:

-XX:MaxPermSize=256m

Also, you might want to increase the maximum heap size with this kind of switch:

-Xmx1g

You will need to test the settings a little to see which exact values are suitable for you.

These settings can be put into tomcat/bin/setenv.sh file, for example:

CATALINA_OPTS="-Xmx1g -XX:MaxPermSize=256m"
Tommi
@Tommi what file do you put these settings in?
EugeneP
Put them in your setenv.sh file... and set the environment variable CATALINA_OPTS in there. (Edited original answer with this info, too.)
Tommi
+2  A: 

PermGenSpace error happens because there's a memory leak during the undeploy/deploy cycle.

Undeploying an application should in theory not result in any memory leak, but it's a known issue that subtle dependencies between objects in different class loaders can cause memory leaks in app. server.

A short-term remedy is to configure the JVM memory (-Xms, -Xms, etc.) in a way that it doesn't blow after 2-3 redeployment but after many more, so that you need to restart Tomcat less frequently.

The long-term remedy would be to analyze what causes the memory leak. That's usually not a problem from Tomcat, neither the garbage collection, nor the application code, but rather the deployment of various libraries in different classloaders. A good article to understand this problem is:

And here is a SO question that I suggest you look at, where the OP had a similar issue:

ewernli