[systemd-devel] [PATCH] service: don't try to kill the service more than once when the watchdog timeout hits

Michael Olbrich m.olbrich at pengutronix.de
Tue Jun 11 16:22:46 PDT 2013


If ExecStopPost= is defined then it is executed after SIGKILL. Otherwise
another round of SIGTERM/SIGSTOP is started which is rather useless when
the watchdog timeout hits.
So go directly to the final SIGKILL if ExecStopPost= is not defined.
---

Hi,

I did some more testing with this. I think this is better. Running
ExecStopPost= if available is a good idea, but don't waste any time
otherwise.

Michael

 src/core/service.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/core/service.c b/src/core/service.c
index dadd981..984993f 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -249,7 +249,10 @@ static void service_handle_watchdog(Service *s) {
         offset = now(CLOCK_MONOTONIC) - s->watchdog_timestamp.monotonic;
         if (offset >= s->watchdog_usec) {
                 log_error_unit(UNIT(s)->id, "%s watchdog timeout!", UNIT(s)->id);
-                service_enter_signal(s, SERVICE_STOP_SIGKILL, SERVICE_FAILURE_WATCHDOG);
+                if (s->exec_command[SERVICE_EXEC_STOP_POST])
+                        service_enter_signal(s, SERVICE_STOP_SIGKILL, SERVICE_FAILURE_WATCHDOG);
+                else
+                        service_enter_signal(s, SERVICE_FINAL_SIGKILL, SERVICE_FAILURE_WATCHDOG);
                 return;
         }
 
-- 
1.8.2.rc2



More information about the systemd-devel mailing list