Mercurial > dovecot > core-2.2
changeset 18894:5631687b52ef
master: When sending SIGTERM/SIGKILL to processes, log which services they were sent to.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 30 Jun 2015 11:26:47 +0300 |
parents | 86b75d360241 |
children | d4422b0560fe |
files | src/master/service.c |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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)