From: Stefan Fritsch
Date: Sun, 15 Jul 2012 19:52:06 +0000 (+0000)
Subject: Don't count connections in lingering close state when
X-Git-Tag: 2.5.0-alpha~6648
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=773c6e29324c52e490a6a814f7ecb5acff9bb858;p=apache
Don't count connections in lingering close state when
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
---
diff --git a/CHANGES b/CHANGES
index 9f9ce7a6b5..2c87537ca0 100644
--- 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]
diff --git a/docs/manual/mod/event.xml b/docs/manual/mod/event.xml
index 81275a3a75..c27136058d 100644
--- a/docs/manual/mod/event.xml
+++ b/docs/manual/mod/event.xml
@@ -166,7 +166,8 @@ of consuming threads only for connections with active processing
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:
+ connections (not counting connections in the "closing" state) is lower
+ than:
ThreadsPerChild +
diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c
index a0df93bcb1..4bfc221e22 100644
--- a/server/mpm/event/event.c
+++ b/server/mpm/event/event.c
@@ -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);