From 663ca17792993f977ea820015e647f76791c1aaf Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Thu, 18 Feb 2016 12:06:39 +0000 Subject: [PATCH] ensure sane defaults git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1731052 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/motorz/motorz.c | 40 ++++++++++++++++++++++++++++----- server/mpm/motorz/mpm_default.h | 16 +------------ 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/server/mpm/motorz/motorz.c b/server/mpm/motorz/motorz.c index fb7f84c905..0391e67539 100644 --- a/server/mpm/motorz/motorz.c +++ b/server/mpm/motorz/motorz.c @@ -20,8 +20,8 @@ * config globals */ static motorz_core_t *g_motorz_core; -static int threads_per_child = 0; -static int ap_num_kids = 0; +static int threads_per_child = 16; +static int ap_num_kids = DEFAULT_START_DAEMON; static int mpm_state = AP_MPMQ_STARTING; /* one_process --- debugging mode variable; can be set from the command line @@ -1675,21 +1675,21 @@ static int motorz_check_config(apr_pool_t *p, apr_pool_t *plog, startup = 1; } - if (ap_num_kids > MAX_SERVER_LIMIT) { + if (ap_num_kids > DEFAULT_SERVER_LIMIT) { if (startup) { ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, APLOGNO(02886) "WARNING: StartServers of %d exceeds compile-time " "limit of", ap_num_kids); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, APLOGNO(03118) " %d servers, decreasing to %d.", - MAX_SERVER_LIMIT, MAX_SERVER_LIMIT); + DEFAULT_SERVER_LIMIT, DEFAULT_SERVER_LIMIT); } else { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, APLOGNO(02887) "StartServers of %d exceeds compile-time limit " "of %d, decreasing to match", - ap_num_kids, MAX_SERVER_LIMIT); + ap_num_kids, DEFAULT_SERVER_LIMIT); } - ap_num_kids = MAX_SERVER_LIMIT; + ap_num_kids = DEFAULT_SERVER_LIMIT; } else if (ap_num_kids < 1) { if (startup) { @@ -1704,6 +1704,34 @@ static int motorz_check_config(apr_pool_t *p, apr_pool_t *plog, ap_num_kids = 1; } + if (threads_per_child > MAX_THREAD_LIMIT) { + if (startup) { + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, APLOGNO() + "WARNING: ThreadsPerChild of %d exceeds compile-time " + "limit of", threads_per_child); + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, APLOGNO() + " %d servers, decreasing to %d.", + MAX_THREAD_LIMIT, MAX_THREAD_LIMIT); + } else { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, APLOGNO() + "ThreadsPerChild of %d exceeds compile-time limit " + "of %d, decreasing to match", + threads_per_child, MAX_THREAD_LIMIT); + } + threads_per_child = MAX_THREAD_LIMIT; + } + else if (threads_per_child < 1) { + if (startup) { + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, APLOGNO() + "WARNING: ThreadsPerChild of %d not allowed, " + "increasing to 1.", threads_per_child); + } else { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, APLOGNO() + "ThreadsPerChild of %d not allowed, increasing to 1", + threads_per_child); + } + threads_per_child = 1; + } return OK; } diff --git a/server/mpm/motorz/mpm_default.h b/server/mpm/motorz/mpm_default.h index d8ab8012fb..9bc59f0ae6 100644 --- a/server/mpm/motorz/mpm_default.h +++ b/server/mpm/motorz/mpm_default.h @@ -29,21 +29,7 @@ /* Number of servers to spawn off by default --- */ #ifndef DEFAULT_START_DAEMON -#define DEFAULT_START_DAEMON 1 -#endif - -/* Maximum number of *free* server processes --- more than this, and - * they will die off. - */ - -#ifndef DEFAULT_MAX_FREE_DAEMON -#define DEFAULT_MAX_FREE_DAEMON 2 -#endif - -/* Minimum --- fewer than this, and more will be created */ - -#ifndef DEFAULT_MIN_FREE_DAEMON -#define DEFAULT_MIN_FREE_DAEMON 1 +#define DEFAULT_START_DAEMON 2 #endif #endif /* AP_MPM_DEFAULT_H */ -- 2.50.1