Return-Path: X-Original-To: apmail-httpd-cvs-archive@www.apache.org Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BAFD4986B for ; Mon, 23 Jul 2012 12:16:01 +0000 (UTC) Received: (qmail 64094 invoked by uid 500); 23 Jul 2012 12:16:00 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 64052 invoked by uid 500); 23 Jul 2012 12:16:00 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 64041 invoked by uid 99); 23 Jul 2012 12:16:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jul 2012 12:16:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jul 2012 12:15:58 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D2A6C238889B; Mon, 23 Jul 2012 12:15:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1364601 - in /httpd/httpd/trunk/server/mpm: event/event.c worker/worker.c Date: Mon, 23 Jul 2012 12:15:39 -0000 To: cvs@httpd.apache.org From: trawick@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120723121539.D2A6C238889B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: trawick Date: Mon Jul 23 12:15:39 2012 New Revision: 1364601 URL: http://svn.apache.org/viewvc?rev=1364601&view=rev Log: Follow up to r1363557: Refactor with some existing code to slightly optimize thread tracking. Fix an implementation problem affecting statically linked MPMs which would break the ability to fail restart if a resource shortage was found immediately. Found by: rjung Modified: httpd/httpd/trunk/server/mpm/event/event.c httpd/httpd/trunk/server/mpm/worker/worker.c Modified: httpd/httpd/trunk/server/mpm/event/event.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1364601&r1=1364600&r2=1364601&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/event/event.c (original) +++ httpd/httpd/trunk/server/mpm/event/event.c Mon Jul 23 12:15:39 2012 @@ -171,6 +171,7 @@ static int ap_daemons_limit = 0; static int max_workers = 0; static int server_limit = 0; static int thread_limit = 0; +static int had_healthy_child = 0; static int dying = 0; static int workers_may_exit = 0; static int start_thread_may_exit = 0; @@ -183,7 +184,6 @@ static apr_uint32_t lingering_count = 0; static apr_uint32_t suspended_count = 0; /* Number of suspended connections */ static apr_uint32_t clogged_count = 0; /* Number of threads processing ssl conns */ static int resource_shortage = 0; -static int had_healthy_child = 0; static fd_queue_t *worker_queue; static fd_queue_info_t *worker_queue_info; static int mpm_state = AP_MPMQ_STARTING; @@ -2439,11 +2439,11 @@ static void perform_idle_server_maintena ++idle_thread_count; } if (status >= SERVER_READY && status < SERVER_GRACEFUL) { - ++active_thread_count; ++child_threads_active; } } } + active_thread_count += child_threads_active; if (any_dead_threads && totally_free_length < retained->idle_spawn_rate && free_length < MAX_SPAWN_RATE @@ -2947,6 +2947,7 @@ static int event_pre_config(apr_pool_t * ap_daemons_limit = server_limit; threads_per_child = DEFAULT_THREADS_PER_CHILD; max_workers = ap_daemons_limit * threads_per_child; + had_healthy_child = 0; ap_extended_status = 0; return OK; Modified: httpd/httpd/trunk/server/mpm/worker/worker.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=1364601&r1=1364600&r2=1364601&view=diff ============================================================================== --- httpd/httpd/trunk/server/mpm/worker/worker.c (original) +++ httpd/httpd/trunk/server/mpm/worker/worker.c Mon Jul 23 12:15:39 2012 @@ -122,6 +122,7 @@ static int ap_daemons_limit = 0; static int max_workers = 0; static int server_limit = 0; static int thread_limit = 0; +static int had_healthy_child = 0; static int dying = 0; static int workers_may_exit = 0; static int start_thread_may_exit = 0; @@ -129,7 +130,6 @@ static int listener_may_exit = 0; static int requests_this_child; static int num_listensocks = 0; static int resource_shortage = 0; -static int had_healthy_child = 0; static fd_queue_t *worker_queue; static fd_queue_info_t *worker_queue_info; static int mpm_state = AP_MPMQ_STARTING; @@ -1508,11 +1508,11 @@ static void perform_idle_server_maintena ++idle_thread_count; } if (status >= SERVER_READY && status < SERVER_GRACEFUL) { - ++active_thread_count; ++child_threads_active; } } } + active_thread_count += child_threads_active; if (any_dead_threads && totally_free_length < retained->idle_spawn_rate && free_length < MAX_SPAWN_RATE && (!ps->pid /* no process in the slot */ @@ -2028,6 +2028,7 @@ static int worker_pre_config(apr_pool_t ap_daemons_limit = server_limit; threads_per_child = DEFAULT_THREADS_PER_CHILD; max_workers = ap_daemons_limit * threads_per_child; + had_healthy_child = 0; ap_extended_status = 0; return OK;