From 773c6e29324c52e490a6a814f7ecb5acff9bb858 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Sun, 15 Jul 2012 19:52:06 +0000 Subject: [PATCH] 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 --- CHANGES | 4 ++++ docs/manual/mod/event.xml | 3 ++- server/mpm/event/event.c | 17 ++++++++++------- 3 files changed, 16 insertions(+), 8 deletions(-) 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); -- 2.49.0