Mercurial > dovecot > core-2.2
changeset 11517:3fa10300c70c HEAD
master: If an idling process seems stuck, log an error and disable it.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 09 Jun 2010 21:09:34 +0100 |
parents | 67b8de25154c |
children | 5ede18fe35fa |
files | src/master/service-monitor.c src/master/service-process.h |
diffstat | 2 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 */
--- 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;