[systemd-devel] [PATCH] service: don't try to kill the service more than once when the watchdog timeout hits
Lennart Poettering
lennart at poettering.net
Tue Jul 16 18:53:09 PDT 2013
On Wed, 12.06.13 01:22, Michael Olbrich (m.olbrich at pengutronix.de) wrote:
> 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.
Hmm, why not go always directly into SERVICE_FINAL_SIGKILL? Why bother
with SERVICE_STOP_SIGKILL at all? What am I missing?
> ---
>
> 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;
> }
>
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list