This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/7.0.x by this push:
new ab59b92 Fix BZ 64765 correctly track submitted count on undeploy
ab59b92 is described below
commit ab59b92412795103c71b61d784446e595c33df20
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 0e3ff4c..4471506 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -66,6 +66,13 @@
Correct numerous spellings throughout the code base. Based on a pull
request from John Bampton. (markt)
</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="Web applications">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]