You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/07/23 15:13:19 UTC
[Bug 56765] New: Classloader leak in Tomcat 8.0.9 caused by DBCP 2.0
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: dtgjyhdty@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 56765] Classloader leak in Tomcat 8.0.9 caused by DBCP 2.0
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56765
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Mark Thomas <ma...@apache.org> ---
This was fixed in Commons Pool 2 with r1626998 for version 2.3
This fix was in turn picked up by Tomcat 8.0.17 onwards.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 56765] Classloader leak in Tomcat 8.0.9 caused by DBCP 2.0
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56765
John Anderson <dt...@yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Hardware|PC |All
OS| |All
--- Comment #1 from John Anderson <dt...@yahoo.com> ---
I tried to replace tomcat-dbcp.jar in Tomcat's lib directory with the file from
Tomcat 7.0.54 and it indeed fixed the leak. I only had to add
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" to my context.xml.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 56765] Classloader leak in Tomcat 8.0.9 caused by DBCP 2.0
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56765
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|jdbc-pool |Catalina
Version|unspecified |trunk
Product|Tomcat Modules |Tomcat 8
Target Milestone|--- |----
--- Comment #3 from Mark Thomas <ma...@apache.org> ---
Fix the product.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 56765] Classloader leak in Tomcat 8.0.9 caused by DBCP 2.0
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56765
--- Comment #2 from prabash balasuriya <pr...@yahoo.com> ---
Had the same issue and below is my gc root . Applied the solution mentioned
here and it was successful. I am using tomcat-8.0.15 and downgraded
tomcat-dbcp.jar file from tomcat-7.0.35.
this - value: org.apache.catalina.loader.WebappClassLoader #1
<- <classLoader> - class: oracle.jdbc.driver.T4CConnection, value:
org.apache.catalina.loader.WebappClassLoader #1
<- <class> - class: oracle.jdbc.driver.T4CConnection, value:
oracle.jdbc.driver.T4CConnection class T4CConnection
<- _conn - class: org.apache.tomcat.dbcp.dbcp2.PoolableConnection,
value: oracle.jdbc.driver.T4CConnection #1
<- resource - class: com.sun.jmx.mbeanserver.MXBeanSupport, value:
org.apache.tomcat.dbcp.dbcp2.PoolableConnection #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 #46
<- [130] - class: java.util.HashMap$Entry[], value:
java.util.HashMap$Entry #6594
<- table - class: java.util.HashMap, value:
java.util.HashMap$Entry[] #1274 (512 items)
<- value - class: java.util.HashMap$Entry, value:
java.util.HashMap #275
<- [4] - class: java.util.HashMap$Entry[], value:
java.util.HashMap$Entry #1931
<- table - class: java.util.HashMap, value:
java.util.HashMap$Entry[] #211 (16 items)
<- domainTb - class: com.sun.jmx.mbeanserver.Repository, value:
java.util.HashMap #268
<- 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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org