Code Comments
Programming Forum and web based access to our favorite programming groups.I've a situation where Tomcat is crashing with an out of memory error every 24-48 hours. I think I may have narrowed down the cause: we have tens of thousands of jsp pages, and every time one of them is compiled i see the heap size grow, and it never shrinks back down. Eventually Tomcat becomes unresponsive, writes out of memory to the catalina log, and I have to restart it. Here's what I'm running: RedHat Linux ES 3.0 Apache 2.0.46 with ( mod_jk ) Tomcat 4.1.24 Sun j2sdk 1.4.2_03 My question is, I've explicitly set it in the web.xml configuration so that Tomcat forks javac processes to another memory partition. Even so, I'm seeing out of memory reported by Tomcat. Is this a memory leak in javac, Ant, or is my original hypothesis incorrect? thanks, Dale
Post Follow-up to this messageOn 27 Sep 2004 10:51:00 -0700, Dale <dalelum@gmail.com> wrote: > I've a situation where Tomcat is crashing with an out of memory error > every 24-48 hours. I think I may have narrowed down the cause: we have > tens of thousands of jsp pages, and every time one of them is compiled > i see the heap size grow, and it never shrinks back down. Eventually > Tomcat becomes unresponsive, writes out of memory to the catalina log, > and I have to restart it. Here's what I'm running: > > RedHat Linux ES 3.0 > apache 2.0.46 with ( mod_jk ) > Tomcat 4.1.24 > Sun j2sdk 1.4.2_03 > > My question is, I've explicitly set it in the web.xml configuration so > that Tomcat forks javac processes to another memory partition. Even > so, I'm seeing out of memory reported by Tomcat. Is this a memory leak > in javac, Ant, or is my original hypothesis incorrect? > > thanks, > Dale Tomcat 5 release notes contain this: -quote- -------------------- JAVAC leaking memory: -------------------- The Java compiler leaks memory each time a class is compiled. Web applications containing hundreds of JSP files may as a result trigger out of memory errors once a significant number of pages have been accessed. The memory can only be freed by stopping Tomcat and then restarting it. The JSP command line compiler (JSPC) can also be used to precompile the JSPs. Note: This issue has been fixed in Sun JDK 1.4.x. -endquote- Bill
Post Follow-up to this message> Tomcat 5 release notes contain this: > -quote- > -------------------- > JAVAC leaking memory: > -------------------- > > The Java compiler leaks memory each time a class is compiled. Web > applications > containing hundreds of JSP files may as a result trigger out of memory > errors > once a significant number of pages have been accessed. The memory can > only be > freed by stopping Tomcat and then restarting it. > > The JSP command line compiler (JSPC) can also be used to precompile the > JSPs. > > Note: This issue has been fixed in Sun JDK 1.4.x. > -endquote- Yes, I've read that. I am running the 1.4.2 JDK. I've also set javac to fork. The Tomcat docs have this to say about that: fork - The internal JVM javac compiler used by Ant has a known memory leak. And Ant requires that java compiles be synchronized, i.e. only one JSP page can be compiled at a time. Set fork to true or do not define it (it is the default value) so that Ant compiles JSP pages in a seperate JVM. This removes the synchronization of JSP page compiles and prevents all the javac classes from being instantiated and subsequently garbage collected by the JVM Tomcat is running in. This also works around known issues with javac, including memory leaking, as well as JAR file locking on Windows.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.