Author: markt
Date: Tue Oct 29 09:53:27 2013
New Revision: 1536632
URL: http://svn.apache.org/r1536632
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/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=1536632&r1=1536631&r2=1536632&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties Tue
Oct 29 09:53:27 2013
@@ -30,6 +30,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/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=1536632&r1=1536631&r2=1536632&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Tue Oct
29 09:53:27 2013
@@ -2482,8 +2482,18 @@ public class WebappClassLoader extends U
// Get the current thread group
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;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]