|
|
|
[
Permlink
| « Hide
]
Daniel Patterson [16/Mar/06 03:40 PM]
Screenshot of the interesting components of the heap dump. Hope this helps.
We were using the <htmlemail> publisher as part of this project. Yesterday, I turned that off, and the OUTOFMEMORY problems that we get every day seem to have temporarily abated. Memory usage seems to be growing, but a lot slower. I'll update this defect further in a couple of days.
Ok, after a couple of days running without <htmlemail>, it appears that we're no longer leaking. Certainly, memory usage has stabilised well below our maximum heap size (currently around 294 of 1024 MB).
I did some memory profiling (using NetBeans Profiler) to debug memory problems with the contrib/distributed (CCDist) a while back and I found the same behavior: Removing the HTMLEmail publisher signficantly improved memory usage. Small spikes occurred during the build lifecycle only when the processing HTMLEmail and some of that memory was never collected after each spike. (CCDist tends to perform many more builds than non-Dist, and all the publishing work is done on the Master CC instance, so the memory issue shows up quickly and regularly).
Have you tried using a newer version of the XML libs to see if that improves the situation? Dan FWIW, I finally had a chance to try upgrading the xml libs, and had some unexpected results:
I upgraded to version 2.8.0 of "xercesImpl" and "xml-apis". All CC unit tests passed, but after a week or so running, I saw no improvement in the memory leak. (Upgraded all copies in /lib, /main/lib, /reporting/jsp/lib, and even my tomcat endorsed dir for good measure). When I also upgraded the xalan jar to v2.7.0, I get the following unit test failure in the CC main tree. [junit] Testcase: testTransformWithParameter(net.sourceforge.cruisecontrol.publishers.HTMLEmailPublisherTest): Cause d an ERROR [junit] org/apache/xml/serializer/SerializerTrace [junit] java.lang.NoClassDefFoundError: org/apache/xml/serializer/SerializerTrace [junit] at java.lang.ClassLoader.defineClass1(Native Method) [junit] at java.lang.ClassLoader.defineClass(ClassLoader.java:620) [junit] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) [junit] at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) [junit] at java.net.URLClassLoader.access$100(URLClassLoader.java:56) [junit] at java.net.URLClassLoader$1.run(URLClassLoader.java:195) [junit] at java.security.AccessController.doPrivileged(Native Method) [junit] at java.net.URLClassLoader.findClass(URLClassLoader.java:188) [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:306) [junit] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:251) [junit] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) [junit] at org.apache.xalan.processor.ProcessorStylesheetElement.getStylesheetRoot(ProcessorStylesheetElement.java:12 1) [junit] at org.apache.xalan.processor.ProcessorStylesheetElement.startElement(ProcessorStylesheetElement.java:72) [junit] at org.apache.xalan.processor.StylesheetHandler.startElement(StylesheetHandler.java:623) [junit] at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) [junit] at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) [junit] at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source) [junit] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) [junit] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) [junit] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) [junit] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) [junit] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) [junit] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) [junit] at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) [junit] at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:920) [junit] at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:774) [junit] at net.sourceforge.cruisecontrol.publishers.HTMLEmailPublisher.transformFile(HTMLEmailPublisher.java:444) [junit] at net.sourceforge.cruisecontrol.publishers.HTMLEmailPublisherTest.testTransformWithParameter(HTMLEmailPublis herTest.java:259) BUILD FAILED I found that xalan had separated some classes into a new jar: serializer.jar, so I then added serializer-2.7.0.jar to various paths, and the CC Main unit tests were happy. I will attempt running with this setup for a while and report what happens regarding any memory leak changes. Dan Just a quick note to possibly narrow down the problem. Looking at the heap dump, it looks
like the most interesting thing closest to the big collection of SAXParsers is an XMLReaderManager: http://xml.apache.org/xalan-j/apidocs/org/apache/xml/utils/XMLReaderManager.html "Creates XMLReader objects and caches them for re-use. This class follows the singleton pattern." Looks like someone is calling "getXMLReader() " without ever calling "releaseXMLReader(XMLReader reader) " If I get time, I'll try and hunt down where. Finally some good news about this SAX/HTMLEmailPublisher memory leak: Updated xml jars appear to have fixed the problem.
I replaced the following xml jars (xercesImpl, xml-apis) with: xercesImpl-2.8.0.jar xml-apis-2.8.0.jar in lib, main/lib, and reporting/jsp/lib (and of course updated all paths to use the new jars), but these jars alone didn't solve the problem. After a few days, CC was still eating upwards of 800mb of ram. I then replaced xalan-2.6.0.jar with: xalan-2.7.0.jar AND serializer-2.7.0.jar (the new xalan has separated some classes CC needs into this new jar). in main/lib and reporting/jsp/lib. This appears to have fixed the leak: After a week of continuous builds, CC peaked at 250mb and has been averaging around 150mb of usage. Also, I haven't seen any other side effects using the new jars. If it is useful, I can put together a diff of all the paths I had to change, but it's pretty much a global search and replace (except for adding the new serializer-2.7.0.jar wherever xalan.jar was used). Dan This seems like quite a find. Can we get this one into 2.5?
We have CC OOMing 1-2 times per week, and are also using HTMLEmail. all jars and .bat/.sh and build.xml files updated appropriately (I think).
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||