]> granicus.if.org Git - apache/commitdiff
Don't count connections in lingering close state when
authorStefan Fritsch <sf@apache.org>
Sun, 15 Jul 2012 19:52:06 +0000 (19:52 +0000)
committerStefan Fritsch <sf@apache.org>
Sun, 15 Jul 2012 19:52:06 +0000 (19:52 +0000)
calculating how many additional connections may be accepted

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1361778 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/event.xml
server/mpm/event/event.c

diff --git a/CHANGES b/CHANGES
index 9f9ce7a6b51a5d4678a1fc1d91d46c881ea2c053..2c87537ca0f8dd6ab63e3cb0127a31ba596d3417 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mpm_event: Don't count connections in lingering close state when
+     calculating how many additional connections may be accepted.
+     [Stefan Fritsch]
+
   *) mod_deflate: Skip compression if compression is enabled at SSL level.
      [Stefan Fritsch]
 
index 81275a3a757749277093062b8d38e607d04d9da9..c27136058d4d425068dc8dc815e9b7f62bd7fb25 100644 (file)
@@ -166,7 +166,8 @@ of consuming threads only for connections with active processing</description>
 
     <p>This directive can be used to fine-tune the per-process connection
     limit. A process will only accept new connections if the current number of
-    connections is lower than:</p>
+    connections (not counting connections in the "closing" state) is lower
+    than:</p>
 
     <p class="indent"><strong>
         <directive module="mpm_common">ThreadsPerChild</directive> +
index a0df93bcb13b66e0bc01853494e31cdc8589854e..4bfc221e22e9cabedb20d6e6089321c50e303c54 100644 (file)
@@ -1632,9 +1632,11 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)
                                  "All workers busy, not accepting new conns"
                                  "in this process");
                 }
-                else if (apr_atomic_read32(&connection_count) > threads_per_child
-                         + ap_queue_info_get_idlers(worker_queue_info) *
-                           worker_factor / WORKER_FACTOR_SCALE)
+                else if (  (int)apr_atomic_read32(&connection_count)
+                           - (int)apr_atomic_read32(&lingering_count)
+                         > threads_per_child
+                           + ap_queue_info_get_idlers(worker_queue_info) *
+                             worker_factor / WORKER_FACTOR_SCALE)
                 {
                     if (!listeners_disabled)
                         disable_listensocks(process_slot);
@@ -1769,10 +1771,11 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)
             ps->suspended = apr_atomic_read32(&suspended_count);
             ps->lingering_close = apr_atomic_read32(&lingering_count);
         }
-        if (listeners_disabled && !workers_were_busy &&
-            (int)apr_atomic_read32(&connection_count) <
-            ((int)ap_queue_info_get_idlers(worker_queue_info) - 1) *
-            worker_factor / WORKER_FACTOR_SCALE + threads_per_child)
+        if (listeners_disabled && !workers_were_busy
+            && (int)apr_atomic_read32(&connection_count)
+               - (int)apr_atomic_read32(&lingering_count)
+               < ((int)ap_queue_info_get_idlers(worker_queue_info) - 1)
+                 * worker_factor / WORKER_FACTOR_SCALE + threads_per_child)
         {
             listeners_disabled = 0;
             enable_listensocks(process_slot);