Author: kkolinko
Date: Thu Jul 17 23:04:58 2014
New Revision: 1611506
URL: http://svn.apache.org/r1611506
Log:
Fix http://issues.apache.org/bugzilla/show_bug.cgi?id=56724
Write an error message to Tomcat logs if container background thread exits
unexpectedly.
Modified:
tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java?rev=1611506&r1=1611505&r2=1611506&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java Thu Jul 17
23:04:58 2014
@@ -1335,14 +1335,28 @@ public abstract class ContainerBase exte
@Override
public void run() {
- while (!threadDone) {
- try {
- Thread.sleep(backgroundProcessorDelay * 1000L);
- } catch (InterruptedException e) {
- // Ignore
+ Throwable t = null;
+ String unexpectedDeathMessage = sm.getString(
+ "containerBase.backgroundProcess.unexpectedThreadDeath",
+ Thread.currentThread().getName());
+ try {
+ while (!threadDone) {
+ try {
+ Thread.sleep(backgroundProcessorDelay * 1000L);
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ if (!threadDone) {
+ processChildren(ContainerBase.this);
+ }
}
+ } catch (RuntimeException|Error e) {
+ t = e;
+ throw e;
+ } finally {
+ thread = null;
if (!threadDone) {
- processChildren(ContainerBase.this);
+ log.error(unexpectedDeathMessage, t);
}
}
}
Modified: tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties?rev=1611506&r1=1611505&r2=1611506&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties Thu Jul
17 23:04:58 2014
@@ -81,6 +81,7 @@ containerBase.threadedStopFailed=A child
containerBase.backgroundProcess.cluster=Exception processing cluster {0}
background process
containerBase.backgroundProcess.realm=Exception processing realm {0}
background process
containerBase.backgroundProcess.valve=Exception processing valve {0}
background process
+containerBase.backgroundProcess.unexpectedThreadDeath=Unexpected death of
background thread {0}
defaultInstanceManager.invalidInjection=Invalid method resource injection
annotation
filterChain.filter=Filter execution threw an exception
filterChain.servlet=Servlet execution threw an exception
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1611506&r1=1611505&r2=1611506&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Jul 17 23:04:58 2014
@@ -64,6 +64,10 @@
<code>MapperListener</code> during repeated starts of embedded Tomcat.
(kkolinko)
</fix>
+ <add>
+ <bug>56724</bug>: Write an error message to Tomcat logs if container
+ background thread is aborted unexpectedly. (kkolinko)
+ </add>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]