We're running tomcat 6.0.35 on a Windows 2008 Server.
It runs out of memory every few days. We noticed in the logs that the server is getting reinitialized randomly.
We see this in the tomcat log.
[main] INFO org.apache.catalina.core.StandardService- Starting service Catalina
And everytime it goes down, we see this warning message:
ERROR org.apache.catalina.loader.WebappClassLoader- The web application [/webconsole] created a ThreadLocal with key of type [org.apache.log4j.helpers.ThreadLocalMap] (value [org.apache.log4j.helpers.ThreadLocalMap@38fc73ee]) and a value of type [java.util.Hashtable] (value [{}]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
We figured that this could be an issue with the log4j bug.
However, the bigger question is why is server getting reinitialized? We checked if there're some files changing that are being watched and thus causing the restart, but there're none.
Will appreciate if someone has any pointers.
Best Answer
This looks like the type of error message that gets logged when tomcat's memory leak detection/prevention gets tripped. The MemoryLeakProtection page on the Tomcat Wiki has more information on it.
You might be able to stop the re-initialization by disabling
autoDeploy
in theHost
element of yourserver.xml
. Tomcat ships by default withautoDeploy
set to true.