Author: markt
Date: Sat May  4 21:11:18 2013
New Revision: 1479177

URL: http://svn.apache.org/r1479177
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54906
Better error message for ConcurrentModificationException when checking for 
memory leaks and continue with remaining checks.
Based on a patch by NateC.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/LocalStrings.properties
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1479175

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/LocalStrings.properties?rev=1479177&r1=1479176&r2=1479177&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/LocalStrings.properties 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/LocalStrings.properties 
Sat May  4 21:11:18 2013
@@ -51,6 +51,7 @@ webappClassLoader.checkThreadLocalsForLe
 webappClassLoader.checkThreadLocalsForLeaksDebug=The web application [{0}] 
created a ThreadLocal with key of type [{1}] (value [{2}]). The ThreadLocal has 
been correctly set to null and the key will be removed by GC.
 webappClassLoader.checkThreadLocalsForLeaksFail=Failed to check for 
ThreadLocal references for web application [{0}]
 webappClassLoader.checkThreadsHttpClient=Found HttpClient keep-alive thread 
using web application class loader. Fixed by switching thread to the parent 
class loader.
+webappClassLoader.loadedByThisOrChildFail=Failed to fully check the entries in 
an instance of [{0}] for potential memory leaks in context [{1}]
 webappClassLoader.stopThreadFail=Failed to terminate thread named [{0}] for 
web application [{1}]
 webappClassLoader.stopTimerThreadFail=Failed to terminate TimerThread named 
[{0}] for web application [{1}]
 webappClassLoader.validationErrorJarPath=Unable to validate JAR entry with 
name {0}

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=1479177&r1=1479176&r2=1479177&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java 
Sat May  4 21:11:18 2013
@@ -43,6 +43,7 @@ import java.security.PrivilegedAction;
 import java.security.ProtectionDomain;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.ConcurrentModificationException;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -2579,11 +2580,17 @@ public class WebappClassLoader
 
         if (o instanceof Collection<?>) {
             Iterator<?> iter = ((Collection<?>) o).iterator();
-            while (iter.hasNext()) {
-                Object entry = iter.next();
-                if (loadedByThisOrChild(entry)) {
-                    return true;
+            try {
+                while (iter.hasNext()) {
+                    Object entry = iter.next();
+                    if (loadedByThisOrChild(entry)) {
+                        return true;
+                    }
                 }
+            } catch (ConcurrentModificationException e) {
+                log.warn(sm.getString(
+                        "webappClassLoader", clazz.getName(), 
getContextName()),
+                        e);
             }
         }
         return false;

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1479177&r1=1479176&r2=1479177&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Sat May  4 21:11:18 2013
@@ -83,6 +83,13 @@
         to) that an error has occurred and that the connection is being closed.
         (markt)
       </fix>
+      <fix>
+        <bug>54906</bug>: Better error message if a
+        <code>ConcurrentModificationException</code> occurs while checking for
+        memory leaks when a web application stops. Also ensure that the
+        exception does not cause remaining checks to be skipped. Based on a
+        patch by NateC.
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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

Reply via email to