dovecot-2.0: master: If an idling process seems stuck, log an er...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 9 23:17:03 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/3fa10300c70c
changeset: 11517:3fa10300c70c
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 09 21:09:34 2010 +0100
description:
master: If an idling process seems stuck, log an error and disable it.

diffstat:

 src/master/service-monitor.c |  15 +++++++++++++++
 src/master/service-process.h |   5 +++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diffs (60 lines):

diff -r 67b8de25154c -r 3fa10300c70c src/master/service-monitor.c
--- a/src/master/service-monitor.c	Wed Jun 09 20:42:14 2010 +0100
+++ b/src/master/service-monitor.c	Wed Jun 09 21:09:34 2010 +0100
@@ -25,19 +25,33 @@
 #define SERVICE_DROP_WARN_INTERVAL_SECS 60
 
 static void service_monitor_start_extra_avail(struct service *service);
+static void service_status_more(struct service_process *process,
+				const struct master_status *status);
 
 static void service_process_kill_idle(struct service_process *process)
 {
 	struct service *service = process->service;
+	struct master_status status;
+
+	i_assert(process->available_count == service->client_limit);
 
 	if (service->process_avail <= service->set->process_min_avail) {
 		/* we don't have any extra idling processes anymore. */
 		timeout_remove(&process->to_idle);
+	} else if (process->last_kill_sent > process->last_status_update+1) {
+		service_error(service, "Process %s is ignoring idle SIGINT",
+			      dec2str(process->pid));
+
+		/* assume this process is busy */
+		memset(&status, 0, sizeof(status));
+		service_status_more(process, &status);
+		process->available_count = 0;
 	} else {
 		if (kill(process->pid, SIGINT) < 0 && errno != ESRCH) {
 			service_error(service, "kill(%s, SIGINT) failed: %m",
 				      dec2str(process->pid));
 		}
+		process->last_kill_sent = ioloop_time;
 	}
 }
 
@@ -126,6 +140,7 @@
 			      "(UID=%u)", dec2str(status->pid), status->uid);
 		return;
 	}
+	process->last_status_update = ioloop_time;
 
 	if (process->to_status != NULL) {
 		/* first status notification */
diff -r 67b8de25154c -r 3fa10300c70c src/master/service-process.h
--- a/src/master/service-process.h	Wed Jun 09 20:42:14 2010 +0100
+++ b/src/master/service-process.h	Wed Jun 09 21:09:34 2010 +0100
@@ -20,6 +20,11 @@
 	/* kill process if it hits idle timeout */
 	struct timeout *to_idle;
 
+	/* time when we last received a status update */
+	time_t last_status_update;
+	/* time when we last sent SIGINT to process */
+	time_t last_kill_sent;
+
 	/* kill the process if it doesn't send initial status notification */
 	struct timeout *to_status;
 


More information about the dovecot-cvs mailing list