Just saw this: https://issues.apache.org/jira/browse/AXIOM-390
From: James Annesley [mailto:james.annes...@infoshare-is.com] Sent: 02 February 2012 12:05 To: java-user@axis.apache.org Subject: RE: Memory leak in Tomcat Thanks for this - very interesting. I have analysed a memory dump and there are 4698 entries with the ??, i.e., leaking. The data comprises as follows: 1) Most are Static references from a variety of components. 2) I have 73 <http://localhost:7000/rootStack/0x78> Java Local References where the following leak from org.apache.tomcat.util.threads.TaskThread, java.util.TimerThread, java.lang.Thread, java.util.TimerThread, java.lang.ref.Finalizer, java.lang.ref.Reference: a. <http://localhost:7000/object/0x782c6d428> org.apache.axiom.util.UIDGeneratorImpl * b. <http://localhost:7000/object/0x77cbccfd8> java.security.SecureClassLoader c. <http://localhost:7000/object/0x77cef6198> org.apache.catalina.startup.Catalina d. <http://localhost:7000/object/0x78204a5e0> org.apache.tomcat.util.net.DefaultServerSocketFactory e. <http://localhost:7000/object/0x782049bd0> sun.rmi.transport.tcp.TCPChannel f. <http://localhost:7000/object/0x782049ba8> sun.rmi.transport.tcp.TCPEndpoint g. <http://localhost:7000/object/0x781eb4210> sun.rmi.transport.tcp.TCPTransport 3) I have 2 JNI Global Reference where the following leak: a. <http://localhost:7000/object/0x782c6d428> org.apache.axiom.util.UIDGeneratorImpl * b. <http://localhost:7000/object/0x781c25750> org.apache.tomcat.util.log.SystemLogHandler c. <http://localhost:7000/object/0x77ca679d0> sun.reflect.DelegatingClassLoader 4) I have 70 System Class References where the following leak: a. <http://localhost:7000/object/0x782c6d428> org.apache.axiom.util.UIDGeneratorImpl * b. <http://localhost:7000/object/0x77e6fbe90> javax.management.remote.rmi.NoCallStackClassLoader c. <http://localhost:7000/object/0x77f8a6b68> org.bouncycastle.jce.provider.BouncyCastleProvider d. <http://localhost:7000/object/0x7837dac20> org.bouncycastle.jce.provider.JCERSAPublicKey e. <http://localhost:7000/object/0x7820055c8> org.apache.naming.resources.DirContextURLStreamHandlerFactory f. <http://localhost:7000/object/0x77e6fbe90> javax.management.remote.rmi.NoCallStackClassLoader g. <http://localhost:7000/object/0x77e7c08b0> com.sun.jmx.remote.util.OrderClassLoaders h. <http://localhost:7000/object/0x77cbccfd8> java.security.SecureClassLoader i. <http://localhost:7000/object/0x77d40dcb0> com.sun.security.auth.PolicyFile j. <http://localhost:7000/object/0x77cf04058> org.apache.tomcat.util.log.SystemLogHandler k. <http://localhost:7000/object/0x77e79eba8> com.sun.jmx.remote.util.ClassLoaderWithRepository l. <http://localhost:7000/object/0x781c13ff0> org.apache.juli.ClassLoaderLogManager m. <http://localhost:7000/object/0x77cbcd420> java.net.URLClassLoader n. <http://localhost:7000/object/0x77cbcd8b8> sun.misc.Launcher o. <http://localhost:7000/object/0x77cbcd420> java.net.URLClassLoader p. java.util.logging.LogManager q. <http://localhost:7000/object/0x77e67eed8> javax.management.remote.JMXConnectorServer r. <http://localhost:7000/object/0x77e6856d0> javax.management.remote.rmi.RMIJRMPServerImpl s. <http://localhost:7000/object/0x77e6bcc70> sun.rmi.server.UnicastRef2 t. <http://localhost:7000/object/0x77e7a1c70> javax.management.remote.rmi.RMIConnectionImpl u. <http://localhost:7000/object/0x77e68fde8> sun.rmi.server.UnicastServerRef2 v. <http://localhost:7000/object/0x781dfee90> java.net.URL w. <http://localhost:7000/object/0x781eb8ed0> sun.rmi.transport.proxy.RMIMasterSocketFactory x. <http://localhost:7000/object/0x78373b8b0> sun.reflect.GeneratedConstructorAccessor35 y. <http://localhost:7000/object/0x77e6bc008> sun.rmi.transport.proxy.RMIDirectSocketFactory z. <http://localhost:7000/object/0x781cda7b8> sun.net.www.protocol.jar.JarFileFactory aa. <http://localhost:7000/object/0x781eb4210> sun.rmi.transport.tcp.TCPTransport * <http://localhost:7000/object/0x782c6d428> org.apache.axiom.util.UIDGeneratorImpl appears in every one in the Java Local, JNDI and System Class references. The advice I am getting is to ignore these because I am planning to restart tomcat after every deployment. Just to keep an eye on perm gen once deployed. It does appear at the very least that axiom is leaking. One other thing I have done is to remove the log4j library which comes with AXIS2 and use the following instead: log4j-over-slf4j-1.6.3.jar slf4j-api-1.6.3.jar logback-classic-1.0.0.jar logback-core-1.0.0.jar Perhaps the logging functions are holding on to something? Can anyone confirm Axiom has a memory leak? James From: Okken,Brett [mailto:bok...@cerner.com] Sent: 01 February 2012 19:17 To: java-user@axis.apache.org Subject: RE: Memory leak in Tomcat This is an indication of a ThreadLocal variable being used within the context of a webapp classloader which did not get cleared out when that application was stopped. This can lead to PermGen memory errors, as the classloader cannot be removed. Tomcat does have some logic in it to try and clean this up (which is what generated the log message below), but it is a best effort basis. See Frank Kieviet's blog[1] discussing classloader memory leaks. [1] - http://blogs.oracle.com/fkieviet/entry/how_to_fix_the_dreaded From: James Annesley [mailto:james.annes...@infoshare-is.com] Sent: Wednesday, February 01, 2012 10:25 AM To: java-user@axis.apache.org Subject: Memory leak in Tomcat Hi, I have an XML beans based AXIS 2 1.6.0 stub. After using the client's UI for a short period of time - say a few minutes - having un-deployed the web app I get about 50 or so messages as follows: 01-Feb-2012 16:21:48 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/xxxx] created a ThreadLocal with key of type [org.apache.xmlbeans.XmlBeans$1] (value [org.apache.xmlbeans.XmlBeans$1@561915df ]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference@1a4d1557]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. Can anyone shed any light on this? Best James Infoshare Ltd Millennium House 21 Eden Street Kingston upon Thames Surrey KT1 1BL United Kingdom Phone: +44 (0) 20 8541 0111 Support: +44 (0) 20 8481 4760 Web: http://www.infoshare-is.com/ E-mail: i...@infoshare-is.com Infoshare Ltd is registered in England and Wales. Registered Office as above. Registered Number 2877612 VAT Number GB 678 1443 10 The content of this e-mail (and any attachment to it) is confidential. Any views or opinions do not represent the views or opinions of Infoshare Ltd. If you have received this e-mail in error please notify the sender and delete it. You may not use, copy or disclose the information in any way. Infoshare Ltd monitors incoming and outgoing e-mails. Please consider the environment. Do you really need to print this email? _____ CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. Infoshare Ltd Millennium House 21 Eden Street Kingston upon Thames Surrey KT1 1BL United Kingdom Phone: +44 (0) 20 8541 0111 Support: +44 (0) 20 8481 4760 Web: http://www.infoshare-is.com/ E-mail: i...@infoshare-is.com Infoshare Ltd is registered in England and Wales. Registered Office as above. Registered Number 2877612 VAT Number GB 678 1443 10 The content of this e-mail (and any attachment to it) is confidential. Any views or opinions do not represent the views or opinions of Infoshare Ltd. If you have received this e-mail in error please notify the sender and delete it. You may not use, copy or disclose the information in any way. Infoshare Ltd monitors incoming and outgoing e-mails. Please consider the environment. Do you really need to print this email? Infoshare Ltd Millennium House 21 Eden Street Kingston upon Thames Surrey KT1 1BL United Kingdom Phone: + 44 (0) 20 8541 0111 Support: + 44 (0) 20 8481 4760 Web: www.infoshare-is.com E-mail: i...@infoshare-is.com Infoshare Ltd is registered in England and Wales. Registered Office as above. Registered Number 2877612 VAT Number GB 678 1443 10 The content of this e-mail (and any attachment to it) is confidential. Any views or opinions do not represent the views or opinions of Infoshare Ltd. If you have received this e-mail in error please notify the sender and delete it. You may not use, copy or disclose the information in any way. Infoshare Ltd monitors incoming and outgoing e-mails. Please consider the environment. Do you really need to print this email?