https://issues.apache.org/bugzilla/show_bug.cgi?id=49668

           Summary: Deeply nested references from ThreadLocal objects are
                    not cleared
           Product: Tomcat 7
           Version: 7.0.0
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: arjencornelis.kni...@getronics.com


Overview
The clearReferencesThreadLocals() method of WebappClassLoader clears two Thread
tables from references to the WebappClassLoader. When using axis, the tables
can have a HashMap as key, which contains (possibly after many nested HashMaps)
a class that was loaded by the WebappClassLoader.

Steps to reproduce
Create a web application that uses the axis 1 SOAP interface. Have the
application call ((WebappClassLoader)
getClass().getClassLoader()).setClearReferencesThreadLocals(true). Deploy the
application in Tomcat. Make a SOAP call to the axis server. Undeploy the web
application. Verify in catalina.out that there are warnings about ThreadLocal
keys being forcibly unregistered.
Wait an hour, make a memory dump using jmap, and inspect it using jhat.

Actual results
The WebappClassLoader is still present. Its "reference chains from rootset"
page shows no references directly from java.lang.ThreadLocal$ThreadLocalMap to
an object of a class that is loaded by this WebappClassLoader. It does show
references via java.lang.ThreadLocal$ThreadLocalMap and one or more nested
HashMaps to the WebappClassLoader:
Static reference from org.apache.catalina.ServerFactory.server (class
org.apache.catalina.ServerFactory)
--> org.apache.catalina.core.standardser...@0xeb400668 (67 bytes) (field
services:)
--> [Lorg.apache.catalina.Service;@0xeb4b4178 (12 bytes) (Element 0 of
[Lorg.apache.catalina.Service;@0xeb4b4178:)
--> org.apache.catalina.core.standardserv...@0xeb4b4188 (62 bytes) (field
container:)
--> org.apache.catalina.core.standardeng...@0xeb4b42c8 (129 bytes) (field
thread:)
--> java.lang.thr...@0xeb58b6e0 (104 bytes) (field threadLocals:)
--> java.lang.threadlocal$threadlocal...@0xeb58b800 (20 bytes) (field table:)
--> [Ljava.lang.ThreadLocal$ThreadLocalMap$Entry;@0xeb58b818 (72 bytes)
(Element 8 of [Ljava.lang.ThreadLocal$ThreadLocalMap$Entry;@0xeb58b818:)
--> java.lang.threadlocal$threadlocalmap$en...@0xeb58b908 (28 bytes) (field
value:)
--> java.util.hash...@0xeb58b928 (40 bytes) (field table:)
--> [Ljava.util.HashMap$Entry;@0xeb58b950 (72 bytes) (Element 0 of
[Ljava.util.HashMap$Entry;@0xeb58b950:)
--> java.util.hashmap$en...@0xeb58bb40 (24 bytes) (field key:)
--> class org.apache.axis.types.Notation (84 bytes) (??:)
--> org.apache.catalina.loader.webappclassloa...@0xeb5a84a0 (157 bytes)


Expected results
The WebappClassLoader for this application is not present anymore.

Build date & platform
Downloaded Core tar.gz from http://tomcat.apache.org/download-70.cgi

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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

Reply via email to