The directives:
MaxClients 512
ServerLimit512
in that order results in
WARNING: MaxClients of 512 exceeds ServerLimit value of 256 servers,
lowering MaxClients to 256. To increase, please see the ServerLimit
directive.
Reversing the directives fixes the problem.
I have tested following variants with changes in plain configuration:
Presence | |
---|---|
MaxClients | x x x x x x o |
ServerLimit| x x x x x x o |
MC > SL| x x x x |
Order (*) | x x |
===|===|
Results| |
---|---|
Values | ok ok ok ok ok ok ok ok ok|
Verbosity | 3 0 3 2 1 1 0 0 0 |
Comments |c c c c c c |
Verbosity -- number of WARNING: to appear.
* - Order with x means ServerLimit appears prior MaxClients.
c - I would say situations with 'c' in comments quite normal and only
one of them has verbosity 2 if MaxClients goes first and with value more
than default one (256).
--
Best regards,
Dmytro
Index: server/mpm/prefork/prefork.c
===
--- server/mpm/prefork/prefork.c(revision 539710)
+++ server/mpm/prefork/prefork.c(working copy)
@@ -96,6 +96,7 @@
static int ap_daemons_min_free=0;
static int ap_daemons_max_free=0;
static int ap_daemons_limit=0; /* MaxClients */
+static int ap_daemons_limit_tmp=0; /* to check MaxClients after
server_limit change */
static int server_limit = DEFAULT_SERVER_LIMIT;
static int first_server_limit = 0;
static int changed_limit_at_restart;
@@ -1371,6 +1372,40 @@
return NULL;
}
+static void check_max_clients ()
+{
+static unsigned char count = 0;
+if (ap_daemons_limit_tmp) {
+ap_daemons_limit = ap_daemons_limit_tmp;
+}
+if (count > 0) {
+ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
+"WARNING: MaxClients is %d now.", ap_daemons_limit);
+ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
+" This message is printed probably because of
ServerLimit");
+ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
+" directive comes after MaxClients in Your config
file.");
+}
+
+if (ap_daemons_limit > server_limit) {
+ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
+"WARNING: MaxClients of %d exceeds ServerLimit value "
+"of %d servers,", ap_daemons_limit, server_limit);
+ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
+" lowering MaxClients to %d. To increase, please "
+"see the ServerLimit", server_limit);
+ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
+" directive.");
+ap_daemons_limit = server_limit;
+count++;
+}
+else if (ap_daemons_limit < 1) {
+ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
+ "WARNING: Require MaxClients > 0, setting to 1");
+ap_daemons_limit = 1;
+}
+}
+
static const char *set_max_free_servers(cmd_parms *cmd, void *dummy, const
char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
@@ -1389,23 +1424,12 @@
return err;
}
-ap_daemons_limit = atoi(arg);
-if (ap_daemons_limit > server_limit) {
- ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
-"WARNING: MaxClients of %d exceeds ServerLimit value "
-"of %d servers,", ap_daemons_limit, server_limit);
- ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
-" lowering MaxClients to %d. To increase, please "
-"see the ServerLimit", server_limit);
- ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
-" directive.");
- ap_daemons_limit = server_limit;
-}
-else if (ap_daemons_limit < 1) {
-ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
- "WARNING: Require MaxClients > 0, setting to 1");
-ap_daemons_limit = 1;
-}
+ap_daemons_limit_tmp = atoi(arg);
+
+/* check max_clients even if server_limit has not been set yet
+ * will recheck if server_limit changed
+ */
+check_max_clients();
return NULL;
}
@@ -1446,6 +1470,9 @@
"WARNING: Require ServerLimit > 0, setting to 1");
server_limit = 1;
}
+
+/* recheck max_clients since server_limit has been changed */
+check_max_clients();
return NULL;
}