]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
master: When sending SIGTERM/SIGKILL to processes, log which services they were sent to.
authorTimo Sirainen <tss@iki.fi>
Tue, 30 Jun 2015 08:26:47 +0000 (11:26 +0300)
committerTimo Sirainen <tss@iki.fi>
Tue, 30 Jun 2015 08:26:47 +0000 (11:26 +0300)
src/master/service.c

index bd349cf79201f1f0a7399161d28cd1f707d705b4..018f850efc5794738f9ed17798f2cc8e6553126d 100644 (file)
@@ -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 @@ int services_create(const struct master_settings *set,
 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 @@ void service_signal(struct service *service, int signo)
                        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)