Author: markt Date: Tue Oct 29 09:55:57 2013 New Revision: 1536634 URL: http://svn.apache.org/r1536634 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55684 Log a warning but continue if the memory leak detection code is unable to access all threads.
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:r1536624,1536632 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=1536634&r1=1536633&r2=1536634&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 Tue Oct 29 09:55:57 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.getThreadGroupError=Unable to obtain the parent for ThreadGroup [{0}]. It will not be possible to check all threads for potential memory leaks 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}] 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=1536634&r1=1536633&r2=1536634&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 Tue Oct 29 09:55:57 2013 @@ -2624,10 +2624,20 @@ public class WebappClassLoader */ private Thread[] getThreads() { // Get the current thread group - ThreadGroup tg = Thread.currentThread( ).getThreadGroup( ); + ThreadGroup tg = Thread.currentThread().getThreadGroup(); // Find the root thread group - while (tg.getParent() != null) { - tg = tg.getParent(); + try { + while (tg.getParent() != null) { + tg = tg.getParent(); + } + } catch (SecurityException se) { + String msg = sm.getString( + "webappClassLoader.getThreadGroupError", tg.getName()); + if (log.isDebugEnabled()) { + log.debug(msg, se); + } else { + log.warn(msg); + } } int threadCountGuess = tg.activeCount() + 50; 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=1536634&r1=1536633&r2=1536634&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Oct 29 09:55:57 2013 @@ -91,6 +91,11 @@ Endpoint. This allows for easier configuration of per connection properties from within <code>modifyHandshake()</code>. (markt) </add> + <fix> + <bug>55684</bug>: Log a warning but continue if the memory leak + detection code is unable to access all threads to check for possible + memory leaks when a web application is stopped. (markt) + </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