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 2010/07/29 16:06:14 UTC

DO NOT REPLY [Bug 49668] New: Deeply nested references from ThreadLocal objects are not cleared

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.Knibbe@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.StandardServer@0xeb400668 (67 bytes) (field
services:)
--> [Lorg.apache.catalina.Service;@0xeb4b4178 (12 bytes) (Element 0 of
[Lorg.apache.catalina.Service;@0xeb4b4178:)
--> org.apache.catalina.core.StandardService@0xeb4b4188 (62 bytes) (field
container:)
--> org.apache.catalina.core.StandardEngine@0xeb4b42c8 (129 bytes) (field
thread:)
--> java.lang.Thread@0xeb58b6e0 (104 bytes) (field threadLocals:)
--> java.lang.ThreadLocal$ThreadLocalMap@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$Entry@0xeb58b908 (28 bytes) (field
value:)
--> java.util.HashMap@0xeb58b928 (40 bytes) (field table:)
--> [Ljava.util.HashMap$Entry;@0xeb58b950 (72 bytes) (Element 0 of
[Ljava.util.HashMap$Entry;@0xeb58b950:)
--> java.util.HashMap$Entry@0xeb58bb40 (24 bytes) (field key:)
--> class org.apache.axis.types.Notation (84 bytes) (??:)
--> org.apache.catalina.loader.WebappClassLoader@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49668] Deeply nested references from ThreadLocal objects are not cleared

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49668

Arjen Knibbe <Ar...@Getronics.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #2 from Arjen Knibbe <Ar...@Getronics.com> 2010-07-30 04:02:31 EDT ---


*** This bug has been marked as a duplicate of bug 49159 ***

-- 
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49668] Deeply nested references from ThreadLocal objects are not cleared

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49668

sylvain.laurent@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #1 from sylvain.laurent@gmail.com 2010-07-29 14:16:29 EDT ---
The clearing of thread locals is now disabled by default since it is not thread
safe (see BZ 48895).

IMHO, this issue is an enhancement request and would be resolved by
implementing BZ 49159.

-- 
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org