You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/02/09 12:17:05 UTC

svn commit: r908002 - in /tomcat/trunk/java/org/apache/catalina/loader: LocalStrings.properties WebappClassLoader.java

Author: markt
Date: Tue Feb  9 11:17:05 2010
New Revision: 908002

URL: http://svn.apache.org/viewvc?rev=908002&view=rev
Log:
If the ThreadLocal is set to null, there won't be a memory leak but GC is required to clean up the keys. Continue to remove the keys if found to reduce the volume of data that has to be looked at when tracing memory leaks.

Modified:
    tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java

Modified: tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties?rev=908002&r1=908001&r2=908002&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties Tue Feb  9 11:17:05 2010
@@ -37,6 +37,7 @@
 webappClassLoader.clearJbdc=A web application registered the JBDC driver [{0}] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
 webappClassLoader.clearRmiInfo=Failed to find class sun.rmi.transport.Target to clear context class loader. This is expected on non-Sun JVMs.
 webappClassLoader.clearRmiFail=Failed to clear context class loader referenced from sun.rmi.transport.Target 
+webappClassLoader.clearThreadLocalDebug=A web application created a ThreadLocal with key of type [{0}] (value [{1}]). The ThreadLocal has been correctly set to null and the key will be removed by GC. However, to simplify the process of tracing memory leaks, the key has been forcibly removed.
 webappClassLoader.clearThreadLocal=A web application created a ThreadLocal with key of type [{0}] (value [{1}]) and a value of type [{2}] (value [{3}]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
 webappClassLoader.clearThreadLocalFail=Failed to clear ThreadLocal references
 webappClassLoader.stopThreadFail=Failed to terminate thread named [{0}]

Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=908002&r1=908001&r2=908002&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Tue Feb  9 11:17:05 2010
@@ -2170,9 +2170,17 @@
                                 args[2] = value.getClass().getCanonicalName();
                                 args[3] = value.toString();
                             }
-                            log.error(sm.getString(
-                                    "webappClassLoader.clearThreadLocal",
-                                    args));
+                            if (value == null) {
+                                if (log.isDebugEnabled()) {
+                                    log.debug(sm.getString(
+                                            "webappClassLoader.clearThreadLocal",
+                                            args));
+                                }
+                            } else {
+                                log.error(sm.getString(
+                                        "webappClassLoader.clearThreadLocal",
+                                        args));
+                            }
                             mapRemove.invoke(map, entry);
                         }
                     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org