Hello,
We are using Tomcat 7.0.94 version and we have facing memory leakage issue when tomcat server is going to shutdown. Please help in this case, how to solve these kind of logs? Please find below sample logs from catalina.log file and code. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads SEVERE: The web application [/TLSAdmin] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads SEVERE: The web application [/TLSAdmin] appears to have started a thread named [schedulerFactory_Worker-1] but has failed to stop it. This is very likely to create a memory leak. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads SEVERE: The web application [/TLSAdmin] appears to have started a thread named [schedulerFactory_Worker-2] but has failed to stop it. This is very likely to create a memory leak. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads SEVERE: The web application [/TLSAdmin] appears to have started a thread named [schedulerFactory_Worker-3] but has failed to stop it. This is very likely to create a memory leak. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads SEVERE: The web application [/TLSAdmin] appears to have started a thread named [schedulerFactory_Worker-4] but has failed to stop it. This is very likely to create a memory leak. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads SEVERE: The web application [/TLSAdmin] appears to have started a thread named [schedulerFactory_Worker-5] but has failed to stop it. This is very likely to create a memory leak. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads SEVERE: The web application [/TLSAdmin] appears to have started a thread named [schedulerFactory_Worker-6] but has failed to stop it. This is very likely to create a memory leak. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads SEVERE: The web application [/TLSAdmin] appears to have started a thread named [schedulerFactory_Worker-7] but has failed to stop it. This is very likely to create a memory leak. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads SEVERE: The web application [/TLSAdmin] appears to have started a thread named [schedulerFactory_Worker-8] but has failed to stop it. This is very likely to create a memory leak. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads SEVERE: The web application [/TLSAdmin] appears to have started a thread named [schedulerFactory_Worker-9] but has failed to stop it. This is very likely to create a memory leak. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads SEVERE: The web application [/TLSAdmin] appears to have started a thread named [schedulerFactory_Worker-10] but has failed to stop it. This is very likely to create a memory leak. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks SEVERE: The web application [/TLSAdmin] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@794fa987]) and a value of type [flex.messaging.config.SystemSettings] (value [flex.messaging.config.SystemSettings@7dca495e]) 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. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks SEVERE: The web application [/TLSAdmin] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@794fa987]) and a value of type [flex.messaging.config.SystemSettings] (value [flex.messaging.config.SystemSettings@7dca495e]) 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. Oct 10, 2019 6:35:36 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks SEVERE: The web application [/TLSAdmin] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@794fa987]) and a value of type [flex.messaging.config.SystemSettings] (value [flex.messaging.config.SystemSettings@7dca495e]) 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. Oct 10, 2019 6:35:36 PM org.apache.coyote.AbstractProtocol stop We have implements below code for "ServletContextListener" public class LogbackContextFinalizer implements ServletContextListener{ private Logger logger = Logger.getLogger(LogbackContextFinalizer.class); private GenericObjectPool objectPool; @Override public void contextDestroyed(ServletContextEvent contextEvent) { logger.info("Context Destroyed Method:"); //ServletContext context = contextEvent.getServletContext(); //LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); //loggerContext.stop(); try { objectPool.close(); } catch (Exception e) { e.printStackTrace(); } Enumeration<Driver> drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { Driver driver = drivers.nextElement(); try { DriverManager.deregisterDriver(driver); logger.info("deregistering jdbc driver: %s" + driver); } catch (SQLException e) { logger.info("Error deregistering driver %s"+ driver); } } } @Override public void contextInitialized(ServletContextEvent contextEvent) { logger.info("Context Initialized Method:"); objectPool = new GenericObjectPool(); objectPool.setFactory(new BasePoolableObjectFactory() { private AtomicInteger counter = new AtomicInteger(0); @Override public Object makeObject() throws Exception { String str = "Object #" + counter.incrementAndGet(); logger.info("Creating "+str); return str; } @Override public void destroyObject(Object obj) throws Exception { logger.info("Destroying "+obj); } }); objectPool.setMinIdle(3); objectPool.setTimeBetweenEvictionRunsMillis(1000); } } Thanks & Regards, Ankit Desai | Associate Project Lead P : +91-79-26404031 to 34 (ext) 00, M : +91-9998347278 A Certified ISO 9001:2015 Company <https://www.spec-india.com/> www.spec-india.com | <http://www.softwaretestingsolution.com/> www.softwaretestingsolution.com | <http://www.mobilesalesforceautomation.net/> www.mobilesalesforceautomation.net | <http://www.ecrmsolutions.co/> www.ecrmsolutions.co "SPEC House", Parth Complex, Near Swastik Cross Roads, Navarangpura, Ahmedabad 380 009, INDIA. Disclaimer: The contents of this E-mail (including the attachment(s) if any) is confidential material of SPEC/SPEC INDIA and is intended solely for the addressee(s). In case you are not the desired addressee you should delete this message and/or re-direct it to the sender. This e-mail message (including the attachment(s) if any) should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee(s). The views expressed in this e-mail message (including the attachment(s) if any) are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of SPEC/SPEC INDIA. This e-mail message(including the attachment(s) if any), is believed to be free of any virus. However, it is the responsibility of the recipient to ensure that it is virus free and SPEC/SPEC INDIA is not responsible for any loss or damage arising in any way from its use.