dovecot-2.1: master: Make service throttling seconds incremental...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jan 27 23:33:16 EET 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/c553725d57bb
changeset: 14015:c553725d57bb
user: Timo Sirainen <tss at iki.fi>
date: Fri Jan 27 23:26:42 2012 +0200
description:
master: Make service throttling seconds incremental, starting from 2 secs.
diffstat:
src/master/service-monitor.c | 13 ++++++++++---
src/master/service.c | 1 +
src/master/service.h | 4 ++++
3 files changed, 15 insertions(+), 3 deletions(-)
diffs (69 lines):
diff -r 300736775b89 -r c553725d57bb src/master/service-monitor.c
--- a/src/master/service-monitor.c Fri Jan 27 23:22:22 2012 +0200
+++ b/src/master/service-monitor.c Fri Jan 27 23:26:42 2012 +0200
@@ -20,7 +20,6 @@
#include <syslog.h>
#include <signal.h>
-#define SERVICE_STARTUP_FAILURE_THROTTLE_SECS 60
#define SERVICE_DROP_WARN_INTERVAL_SECS 60
#define SERVICE_DROP_TIMEOUT_MSECS (10*1000)
#define MAX_DIE_WAIT_SECS 5
@@ -197,8 +196,14 @@
if (service->to_throttle != NULL)
return;
- service_error(service, "command startup failed, throttling");
- service_throttle(service, SERVICE_STARTUP_FAILURE_THROTTLE_SECS);
+ i_assert(service->throttle_secs > 0);
+
+ service_error(service, "command startup failed, throttling for %u secs",
+ service->throttle_secs);
+ service_throttle(service, service->throttle_secs);
+ service->throttle_secs *= 2;
+ if (service->throttle_secs > SERVICE_STARTUP_FAILURE_THROTTLE_MAX_SECS)
+ service->throttle_secs = SERVICE_STARTUP_FAILURE_THROTTLE_MAX_SECS;
}
static void service_drop_timeout(struct service *service)
@@ -564,6 +569,8 @@
service_monitor_listen_start(service);
/* one success resets all failures */
service->exit_failures_in_sec = 0;
+ service->throttle_secs =
+ SERVICE_STARTUP_FAILURE_THROTTLE_MIN_SECS;
throttle = FALSE;
} else {
throttle = service_process_failure(process, status);
diff -r 300736775b89 -r c553725d57bb src/master/service.c
--- a/src/master/service.c Fri Jan 27 23:22:22 2012 +0200
+++ b/src/master/service.c Fri Jan 27 23:26:42 2012 +0200
@@ -218,6 +218,7 @@
service = p_new(pool, struct service, 1);
service->list = service_list;
service->set = set;
+ service->throttle_secs = SERVICE_STARTUP_FAILURE_THROTTLE_MIN_SECS;
service->client_limit = set->client_limit != 0 ? set->client_limit :
set->master_set->default_client_limit;
diff -r 300736775b89 -r c553725d57bb src/master/service.h
--- a/src/master/service.h Fri Jan 27 23:22:22 2012 +0200
+++ b/src/master/service.h Fri Jan 27 23:26:42 2012 +0200
@@ -8,6 +8,9 @@
this many seconds, kill the process */
#define SERVICE_FIRST_STATUS_TIMEOUT_SECS 30
+#define SERVICE_STARTUP_FAILURE_THROTTLE_MIN_SECS 2
+#define SERVICE_STARTUP_FAILURE_THROTTLE_MAX_SECS 60
+
enum service_listener_type {
SERVICE_LISTENER_UNIX,
SERVICE_LISTENER_FIFO,
@@ -80,6 +83,7 @@
int status_fd[2];
struct io *io_status;
+ unsigned int throttle_secs;
time_t exit_failure_last;
unsigned int exit_failures_in_sec;
More information about the dovecot-cvs
mailing list