dovecot-2.0: master: Log a warning at startup if anvil's client_...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Nov 3 17:31:56 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/97b286b6ec45
changeset: 12376:97b286b6ec45
user: Timo Sirainen <tss at iki.fi>
date: Wed Nov 03 15:31:48 2010 +0000
description:
master: Log a warning at startup if anvil's client_limit is too low.
diffstat:
src/master/master-settings.c | 51 +++++++++++++++++++------
1 files changed, 38 insertions(+), 13 deletions(-)
diffs (99 lines):
diff -r d3d07da70102 -r 97b286b6ec45 src/master/master-settings.c
--- a/src/master/master-settings.c Wed Nov 03 15:31:36 2010 +0000
+++ b/src/master/master-settings.c Wed Nov 03 15:31:48 2010 +0000
@@ -369,10 +369,26 @@
}
#endif
+static unsigned int
+service_get_client_limit(struct master_settings *set, const char *name)
+{
+ struct service_settings *const *servicep;
+
+ array_foreach(&set->services, servicep) {
+ if (strcmp((*servicep)->name, name) == 0) {
+ if ((*servicep)->client_limit != 0)
+ return (*servicep)->client_limit;
+ else
+ return set->default_client_limit;
+ }
+ }
+ return set->default_client_limit;
+}
+
static bool
master_settings_verify(void *_set, pool_t pool, const char **error_r)
{
- static int warned_auth = FALSE;
+ static int warned_auth = FALSE, warned_anvil = FALSE;
#ifdef CONFIG_BINARY
const struct service_settings *default_service;
#endif
@@ -380,8 +396,8 @@
struct service_settings *const *services;
const char *const *strings;
ARRAY_TYPE(const_string) all_listeners;
- unsigned int i, j, count, len, process_limit;
- unsigned int auth_client_limit, max_auth_client_processes;
+ unsigned int i, j, count, len, client_limit, process_limit;
+ unsigned int max_auth_client_processes, max_anvil_client_processes;
len = strlen(set->base_dir);
if (len > 0 && set->base_dir[len-1] == '/') {
@@ -448,7 +464,8 @@
}
}
t_array_init(&all_listeners, 64);
- auth_client_limit = max_auth_client_processes = 0;
+ max_auth_client_processes = 0;
+ max_anvil_client_processes = 2; /* blocking, nonblocking pipes */
for (i = 0; i < count; i++) {
struct service_settings *service = services[i];
@@ -495,17 +512,16 @@
}
#endif
- if (strcmp(service->name, "auth") == 0) {
- auth_client_limit = service->client_limit != 0 ?
- service->client_limit :
- set->default_client_limit;
- } else if (*service->protocol != '\0' &&
- str_array_find((const char **)set->protocols_split,
- service->protocol)) {
+ if (*service->protocol != '\0' &&
+ str_array_find((const char **)set->protocols_split,
+ service->protocol)) {
/* each imap/pop3/lmtp process can use up a connection,
although if service_count=1 it's only temporary */
max_auth_client_processes += process_limit;
}
+ if (strcmp(service->type, "login") == 0 ||
+ strcmp(service->name, "auth") == 0)
+ max_anvil_client_processes += process_limit;
fix_file_listener_paths(&service->unix_listeners,
pool, set, &all_listeners);
@@ -514,11 +530,20 @@
add_inet_listeners(&service->inet_listeners, &all_listeners);
}
- if (auth_client_limit < max_auth_client_processes && !warned_auth) {
+ client_limit = service_get_client_limit(set, "auth");
+ if (client_limit < max_auth_client_processes && !warned_auth) {
warned_auth = TRUE;
i_warning("service auth { client_limit=%u } is lower than "
"required under max. load (%u)",
- auth_client_limit, max_auth_client_processes);
+ client_limit, max_auth_client_processes);
+ }
+
+ client_limit = service_get_client_limit(set, "anvil");
+ if (client_limit < max_anvil_client_processes && !warned_anvil) {
+ warned_anvil = TRUE;
+ i_warning("service anvil { client_limit=%u } is lower than "
+ "required under max. load (%u)",
+ client_limit, max_anvil_client_processes);
}
/* check for duplicate listeners */
More information about the dovecot-cvs
mailing list