Reputation: 15
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.
Upvotes: 0
Views: 7301
Reputation: 645
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.
Upvotes: 1
Reputation: 7166
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.
Upvotes: 0
Reputation: 9179
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:
Upvotes: 0