4

every body

i got exception when i run server ,i think it's memory leaks!

i tried many values of parameter JAVA_OPS and still got exception!!!

In console i got this exception you can see as below!

Nov 18, 2013 2:48:48 PM org.apache.catalina.startup.HostConfig deployDescriptors
SEVERE: Error waiting for multi-thread deployment of context descriptors to complete
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: PermGen space
at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:578)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1401)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:317)
at     
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:347)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1140)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.OutOfMemoryError: PermGen space

Exception in thread "main" java.lang.OutOfMemoryError: PermGen space
2
  • Is is probably a problem with Tomcat. It is has a reputation for leaking when class loaders are involved.... Commented Nov 18, 2013 at 12:03
  • When is it happening, what are you doing? Simply adding memory and some more memory isn't solving the problem, only delaying. Commented Nov 18, 2013 at 12:19

6 Answers 6

5

It always makes sense to specify what the "many values" are that you've already tried.

First of all: They'd need to be JAVA_OPTS, but that might also be a typo just in this question. However, it's even better to use CATALINA_OPTS.

Most important, when there are PermGen errors, -Xmx doesn't help at all. You want to set -XX:MaxPermSize=256m (or some other amount of memory). You'll find a lot of information about this issue when you just google the error message - PermGen is a specific region of memory that the Sun/Oracle JVM uses. Increasing the available Heap memory doesn't help at all.

Sign up to request clarification or add additional context in comments.

Comments

3

I find that this also happens with GlassFish, another Java Application Server. Usually, we have to restart the Application Server to free all the memory and resources that the Application Server uses. Most Java Application Servers, like GlassFish and Tomcat, can be quite memory hungry. You may want to add the following line to your catalina.sh file (or other catalina config file) to change the JVM parameters and that could increase the memory allocation:

export CATALINA_OPTS="-Xms512M -Xmx1024M"

Comments

2

What is the point of increasing memory with out analyzing the cause. I would suggest try with some profiling tools(JProfiler, YourToolkKit) to catch the problem guy.

Once you have some idea about what is causing issue, you can work towards it ( for eg: Open connections, unclosed streams etc)

best of luck.

Comments

2

In linux, Add following lines to catalina.sh located in path_to_tomcat/bin.

CLASSPATH=
if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
  . "$CATALINA_BASE/bin/setenv.sh"
elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
  . "$CATALINA_HOME/bin/setenv.sh"
fi

After that, You should create setenv.sh (if not exist in the bin) if you are in path_to_tomcat/bin

vi ./setenv.sh

and add follwing line

export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m"

Now restart the tomcat your problem is over...

Comments

0

In linux , create a setenv.sh file and keep the file inside tomcat/bin folder. Add below line in the file and save it.

export CATALINA_OPTS="$CATALINA_OPTS -server -Xms256m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m"

Now restart tomcat , you are ok to go..!!

Comments

0

You will have to set XX:MaxPermSize in your tomcat server VM argument as below:

Based on your memory on your local system you could modify:

Double click server go to open launch configuration

In vm arguments Put this line

-XX:MaxPermSize=2048m

now restart tomcat

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.