0

Getting below error when running the war file in tomcat7 (Ubuntu):

Exception in thread "http-bio-8080-AsyncTimeout" java.lang.OutOfMemoryError: Java heap space
    at java.util.concurrent.ConcurrentLinkedQueue.iterator(ConcurrentLinkedQueue.java:667)
    at org.apache.tomcat.util.net.JIoEndpoint$AsyncTimeout.run(JIoEndpoint.java:156)
    at java.lang.Thread.run(Thread.java:745)

I am getting above exception when I have put my app.war file in webapps path.

2
  • What is size of war file? Commented Nov 5, 2014 at 13:42
  • 1
    Or rather what is the size of your heap? It seems that you've allocated too little memory to the jvm.. Commented Nov 5, 2014 at 13:44

3 Answers 3

1

Increase the heap size is a must. You could create or edit the $CATALINA_HOME/bin/setenv.sh, add the line:

JAVA_OPTS="-Xms1024m -Xmx2048m"

And then restart tomcat. I think it is better to unpack the war file and copy it to $CATALINA_HOME/webapps, and furthermore, using hot-deploy in production is not a good idea.

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

Comments

0

In my case it happens if Im deploying my application without restarting tomcat. I think GC (garbage-collector) has some problems to free the allocated memory.

My workaround is:

  • Just remove the war file
  • wait some time till your application folder is removed by tomcat
  • stop the server
  • upload the war file
  • and finally start your tomcat instance again.

Comments

0

this is common in the Java world and actually still might affect JRuby ... although hot-deploys are much smoother these days if you're on latest >= 1.7.15 and using jruby-openssl >= 0.9.5. but there still might be gems/libraries that will impose issues reloading and thus will leak memory (one such library is require 'timeout') so you'll need to review the heap dump for leak candidates. also Tomcat usually prints useful hints related to "potential" leak candidates during un/re-deploys.

now, there are things to make sure. if you're on Java 6 you need to use the concurrent (mark-and-sweep) GC as others do not swap the heap space and it's not the default, even so you will need to increase the heap size if you're planning hot-reloads since it needs to be able to hold twice your application's (Java) classes.

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.