This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new 3000011 Fix BZ 64765 correctly track submitted count on undeploy
3000011 is described below
commit 30000117d30182d99188b313de46590de8864889
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Sep 29 20:54:00 2020 +0100
Fix BZ 64765 correctly track submitted count on undeploy
https://bz.apache.org/bugzilla/show_bug.cgi?id=64765
Fix double counting when undeploying a web application with long running
requests when renewThreadsWhenStoppingContext is enabled
---
java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java | 8 +++++++-
webapps/docs/changelog.xml | 7 +++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
index 7298efa..b3fab86 100644
--- a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
+++ b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
@@ -92,7 +92,13 @@ public class ThreadPoolExecutor extends
java.util.concurrent.ThreadPoolExecutor
@Override
protected void afterExecute(Runnable r, Throwable t) {
- submittedCount.decrementAndGet();
+ // Throwing StopPooledThreadException is likely to cause this method to
+ // be called more than once for a given task based on the typical
+ // implementations of the parent class. This test ensures that
+ // decrementAndGet() is only called once after each task execution.
+ if (!(t instanceof StopPooledThreadException)) {
+ submittedCount.decrementAndGet();
+ }
if (t == null) {
stopCurrentThreadIfNeeded();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c5ce8ec..4bd4408 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -89,6 +89,13 @@
<code>NullpointerException</code> when failing to connect to the
database. (kfujino)
</fix>
+ <fix>
+ <bug>64765</bug>: Ensure that the number of currently processing
threads
+ is tracked correctly when a web application is undeployed, long running
+ requests are being processed and
+ <code>renewThreadsWhenStoppingContext</code> is enabled for the web
+ application. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]