]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
master: Log "Processes aren't dying after reload" only when signals are sent
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 24 Aug 2017 13:31:40 +0000 (16:31 +0300)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Fri, 25 Aug 2017 12:21:11 +0000 (15:21 +0300)
This required moving the warning after the "Sent SIG.. to .. processes"
warnings, which is a little bit annoying. However, now it's at least not
unnecessarily logging the warning when it's not doing anything about the
processes.

src/master/service.c

index cb75033b1558db78f0cbdb6877a6271534a65f97..c853f4334fbe0a884d4b45eac2b070570d69f0f2 100644 (file)
@@ -590,9 +590,6 @@ static void services_kill_timeout(struct service_list *service_list)
                sig = SIGKILL;
        service_list->sigterm_sent = TRUE;
 
-       i_warning("Processes aren't dying after reload, sending %s.",
-                 sig == SIGTERM ? "SIGTERM" : "SIGKILL");
-
        log_service = NULL;
        array_foreach(&service_list->services, services) {
                struct service *service = *services;
@@ -619,6 +616,17 @@ static void services_kill_timeout(struct service_list *service_list)
                signal_count += service_signal(log_service, sig, &service_uninitialized);
                uninitialized_count += service_uninitialized;
        }
+       if (signal_count > 0) {
+               string_t *str = t_str_new(128);
+               str_printfa(str, "Processes aren't dying after reload, "
+                           "sent %s to %u processes.",
+                           sig == SIGTERM ? "SIGTERM" : "SIGKILL", signal_count);
+               if (uninitialized_count > 0) {
+                       str_printfa(str, " (%u processes still uninitialized)",
+                                   uninitialized_count);
+               }
+               i_warning("%s", str_c(str));
+       }
 }
 
 void services_destroy(struct service_list *service_list, bool wait)