https://issues.apache.org/bugzilla/show_bug.cgi?id=56765
Bug ID: 56765 Summary: Classloader leak in Tomcat 8.0.9 caused by DBCP 2.0 Product: Tomcat Modules Version: unspecified Hardware: PC Status: NEW Severity: critical Priority: P2 Component: jdbc-pool Assignee: dev@tomcat.apache.org Reporter: dtgjyh...@yahoo.com Created attachment 31843 --> https://issues.apache.org/bugzilla/attachment.cgi?id=31843&action=edit Application and its source code to reproduce the issue Overview: Classloader leak when redeploying a web application which uses Tomcat 8 Database Connection Pool (DBCP 2). This only affects Tomcat 8, probably because it uses DBCP 2; it doesn't occur in Tomcat 7. I attached the test application with source code. The relevant part is in META-INF/context.xml: <Context> <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource" initialSize="1" username="admin" password="" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/" /> </Context> Steps to reproduce: 1. Copy "tomcat8-leak-test.war" to Tomcat's webapps directory. 2. Start Tomcat. 3. Open http://localhost:8080/manager 4. Find "/tomcat8-leak-test" and press Reload. 5. Press Find leaks. Note: You should have MySQL running. Actual Results: Tomcat complains about a memory leak. Expected Results: No leak. Build Date & Hardware: Tomcat 8.0.9 on Windows 7 SP1 Additional Information: Using VisualVM I got the following path from GC root: this - value: org.apache.catalina.loader.WebappClassLoader #1 <- factoryClassLoader - class: org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool, value: org.apache.catalina.loader.WebappClassLoader #1 <- resource - class: com.sun.jmx.mbeanserver.MXBeanSupport, value: org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool #1 <- object - class: com.sun.jmx.mbeanserver.NamedObject, value: com.sun.jmx.mbeanserver.MXBeanSupport #19 <- value - class: java.util.HashMap$Entry, value: com.sun.jmx.mbeanserver.NamedObject #54 <- [1] - class: java.util.HashMap$Entry[], value: java.util.HashMap$Entry #6263 <- table - class: java.util.HashMap, value: java.util.HashMap$Entry[] #505 (16 items) <- value - class: java.util.HashMap$Entry, value: java.util.HashMap #694 <- [11] - class: java.util.HashMap$Entry[], value: java.util.HashMap$Entry #5834 <- table - class: java.util.HashMap, value: java.util.HashMap$Entry[] #216 (16 items) <- domainTb - class: com.sun.jmx.mbeanserver.Repository, value: java.util.HashMap #278 <- repository - class: com.sun.jmx.interceptor.DefaultMBeanServerInterceptor, value: com.sun.jmx.mbeanserver.Repository #1 <- mbsInterceptor - class: com.sun.jmx.mbeanserver.JmxMBeanServer, value: com.sun.jmx.interceptor.DefaultMBeanServerInterceptor #1 <- platformMBeanServer (sticky class) - class: java.lang.management.ManagementFactory, value: com.sun.jmx.mbeanserver.JmxMBeanServer #1 -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org