Konstantin Kolinko wrote: > 2012/3/28 Osipov, Michael <michael.osi...@siemens.com>: >> Hi folks, >> >> Recently this started to pop up in my logs: >> 23.03.2012 14:12:28 org.apache.catalina.loader.WebappClassLoader >> clearReferencesThreads >> SCHWERWIEGEND: The web application [/ket] appears to have started a >> thread named [PoolCleaner[18291494:1332172047553]] but has failed to >> stop it. This is very likely to create a memory leak. >> >> There is some similar thread [1] which had no real result. >> >> I am on Tomcat 6.0.35, all DataSources are created in the >> context.xml file. All DataSources are cleaned up (closed) with a >> context.xml Listener. The JDBC Pool is version 7.0.26. >> >> As far as my debug sessions have revealed (with attached VisualVM), >> it does not matter how many apps you deploy the PoolCleanTimer >> thread is created only once and retained until all apps have been >> stopped or removed. This makes Tomcat think that this is a memory >> leak. >> >> Is there a way to associate this thread with another class loader in >> order to avoid this problem or create multiple threads or simple >> ignore this warning which is not a solution for those who face that >> issue too? > > Is there a way to start it before webapps are started? > > Something similar exists in the following listener: > > <Listener > className="org.apache.catalina.core.JreMemoryLeakPreventionListener" > /> > > At Tomcat startup it calls different API methods that are known to > create such classloader-bound objects. > >> Is there a way to associate this thread with another class loader > > Thread.setContextClassLoader() ? But IIRC this method is not > thread-safe.
I am aware of that method but that was not my point. I guess that could best answered by Mark or Filip. If this TimerTask could be associated with the Bootstrap CL, there would be no warning. >> Besides that, the numbers in the thread name are not very >> informative, the classloader hashcode and timestamp did not really >> help to to identify anything. Can this be improved? > > What would you like to see there? Thread names are not under our > control. Anything else that can be obtained through API calls can be > added. > > Suggestions are welcome. See the code -- search for > "webappClassLoader.warnThread" > in org/apache/catalina/loader/WebappClassLoader.java The warning itself is ok but not the thread name. The thread name here is under implementor's control. See here [1]. The name can easily be confused with Oracle's LDAP Connection PoolCleaner. Something "Tomcat JDBC Pool Cleaner[<hexid>]" would have helped me to find that one way faster. [1] http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?view=markup#l1216 With best regards, Michael Osipov Siemens AG Industry Sector Drive Technologies Division I DT IT LD BLN Nonnendammallee 72 13629 Berlin, Germany mailto:michael.osi...@siemens.com Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Gerhard Cromme; Managing Board: Peter Loescher, Chairman, President and Chief Executive Officer; Roland Busch, Brigitte Ederer, Klaus Helmrich, Joe Kaeser, Barbara Kux, Hermann Requardt, Siegfried Russwurm, Peter Y. Solmssen, Michael Suess; Registered offices: Berlin and Munich, Germany; Commercial registries: Berlin Charlottenburg, HRB 12300, Munich, HRB 6684; WEEE-Reg.-No. DE 23691322 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org