dovecot-2.2: master: When sending SIGTERM/SIGKILL to processes, ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 30 08:29:44 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/5631687b52ef
changeset: 18894:5631687b52ef
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 30 11:26:47 2015 +0300
description:
master: When sending SIGTERM/SIGKILL to processes, log which services they were sent to.

diffstat:

 src/master/service.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r 86b75d360241 -r 5631687b52ef src/master/service.c
--- a/src/master/service.c	Mon Jun 29 20:25:15 2015 +0300
+++ b/src/master/service.c	Tue Jun 30 11:26:47 2015 +0300
@@ -16,7 +16,7 @@
 #include <unistd.h>
 #include <signal.h>
 
-#define SERVICE_DIE_TIMEOUT_MSECS (1000*60)
+#define SERVICE_DIE_TIMEOUT_MSECS (1000*6)
 #define SERVICE_LOGIN_NOTIFY_MIN_INTERVAL_SECS 2
 
 HASH_TABLE_TYPE(pid_process) service_pids;
@@ -508,6 +508,7 @@
 void service_signal(struct service *service, int signo)
 {
 	struct service_process *process = service->processes;
+	unsigned int count = 0;
 
 	for (; process != NULL; process = process->next) {
 		i_assert(process->service == service);
@@ -518,11 +519,18 @@
 			continue;
 		}
 		    
-		if (kill(process->pid, signo) < 0 && errno != ESRCH) {
+		if (kill(process->pid, signo) == 0)
+			count++;
+		else if (errno != ESRCH) {
 			service_error(service, "kill(%s, %d) failed: %m",
 				      dec2str(process->pid), signo);
 		}
 	}
+	if (count > 0) {
+		i_warning("Sent %s to %u %s processes",
+			  signo == SIGTERM ? "SIGTERM" : "SIGKILL",
+			  count, service->set->name);
+	}
 }
 
 static void service_login_notify_send(struct service *service)


More information about the dovecot-cvs mailing list