From: Timo Sirainen Date: Tue, 30 Jun 2015 08:26:47 +0000 (+0300) Subject: master: When sending SIGTERM/SIGKILL to processes, log which services they were sent to. X-Git-Tag: 2.2.19.rc1~300 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffc2b0165fdad6f4cf1c68f813b4b2c3685bfce2;p=thirdparty%2Fdovecot%2Fcore.git master: When sending SIGTERM/SIGKILL to processes, log which services they were sent to. --- diff --git a/src/master/service.c b/src/master/service.c index bd349cf792..018f850efc 100644 --- a/src/master/service.c +++ b/src/master/service.c @@ -16,7 +16,7 @@ #include #include -#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)