This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new cb64ef6 Fix BZ 64765 correctly track submitted count on undeploy
cb64ef6 is described below
commit cb64ef6ada0c1e98c0db9819ff15743d1ba6769e
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 9519118..0be3539 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -88,6 +88,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]