This is an automated email from the ASF dual-hosted git repository.

remm 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 6b2578b8ff Add debug log when going above a configured latch limit
6b2578b8ff is described below

commit 6b2578b8ff69925819ba641b70132aa33aec4a9e
Author: remm <r...@apache.org>
AuthorDate: Tue Apr 23 16:31:11 2024 +0200

    Add debug log when going above a configured latch limit
---
 java/org/apache/tomcat/util/threads/LimitLatch.java         | 5 +++++
 java/org/apache/tomcat/util/threads/LocalStrings.properties | 2 ++
 webapps/docs/changelog.xml                                  | 4 ++++
 3 files changed, 11 insertions(+)

diff --git a/java/org/apache/tomcat/util/threads/LimitLatch.java 
b/java/org/apache/tomcat/util/threads/LimitLatch.java
index 06675dd15d..5eea56aad1 100644
--- a/java/org/apache/tomcat/util/threads/LimitLatch.java
+++ b/java/org/apache/tomcat/util/threads/LimitLatch.java
@@ -22,6 +22,7 @@ import java.util.concurrent.locks.AbstractQueuedSynchronizer;
 
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.res.StringManager;
 
 /**
  * Shared latch that allows the latch to be acquired a limited number of times
@@ -31,6 +32,7 @@ import org.apache.juli.logging.LogFactory;
 public class LimitLatch {
 
     private static final Log log = LogFactory.getLog(LimitLatch.class);
+    private static final StringManager sm = 
StringManager.getManager(LimitLatch.class);
 
     private class Sync extends AbstractQueuedSynchronizer {
         private static final long serialVersionUID = 1L;
@@ -42,6 +44,9 @@ public class LimitLatch {
         protected int tryAcquireShared(int ignored) {
             long newCount = count.incrementAndGet();
             if (!released && newCount > limit) {
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("limitLatch.exceeded", 
Long.valueOf(limit)));
+                }
                 // Limit exceeded
                 count.decrementAndGet();
                 return -1;
diff --git a/java/org/apache/tomcat/util/threads/LocalStrings.properties 
b/java/org/apache/tomcat/util/threads/LocalStrings.properties
index 53856f58a0..5c79a42bd0 100644
--- a/java/org/apache/tomcat/util/threads/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/threads/LocalStrings.properties
@@ -13,6 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+limitLatch.exceeded=Latch limit [{0}] exceeded
+
 taskQueue.notRunning=Executor not running, can't force a command into the queue
 
 taskThread.exiting=Thread exiting on purpose
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index f1fc917298..4608fa5a61 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -159,6 +159,10 @@
         request body uses chunked encoding and is read using non-blocking IO.
         (markt)
       </fix>
+      <fix>
+        <bug>68934</bug>: Add debug logging in the latch object when exceeding
+        <code>maxConnections</code>. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to