diff options
author | Jan Klötzke <Jan.Kloetzke@preh.de> | 2017-11-29 07:43:44 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-04-12 17:32:52 +0200 |
commit | dc653bf487bae9d1ddf794442bf4176fee173b41 (patch) | |
tree | ec2ca709c4d1bdf14dee5252807c8c7e3cb359f0 /src/core/dbus-manager.c | |
parent | 1ace223ca74032a224950665438311eb688f1e05 (diff) | |
download | systemd-dc653bf487bae9d1ddf794442bf4176fee173b41.tar.gz |
service: handle abort stops with dedicated timeout
When shooting down a service with SIGABRT the user might want to have a
much longer stop timeout than on regular stops/shutdowns. Especially in
the face of short stop timeouts the time might not be sufficient to
write huge core dumps before the service is killed.
This commit adds a dedicated (Default)TimeoutAbortSec= timer that is
used when stopping a service via SIGABRT. In all other cases the
existing TimeoutStopSec= is used. The timer value is unset by default
to skip the special handling and use TimeoutStopSec= for state
'stop-watchdog' to keep the old behaviour.
If the service is in state 'stop-watchdog' and the service should be
stopped explicitly we still go to 'stop-sigterm' and re-apply the usual
TimeoutStopSec= timeout.
Diffstat (limited to 'src/core/dbus-manager.c')
-rw-r--r-- | src/core/dbus-manager.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 9c0b994cc3..7ca3b815ef 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -287,6 +287,27 @@ static int property_set_runtime_watchdog( return watchdog_set_timeout(t); } +static int property_get_default_timeout_abort_usec( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *error) { + + Manager *m = userdata; + usec_t t; + + assert(bus); + assert(reply); + assert(m); + + t = manager_default_timeout_abort_usec(m); + + return sd_bus_message_append(reply, "t", t); +} + static int bus_get_unit_by_name(Manager *m, sd_bus_message *message, const char *name, Unit **ret_unit, sd_bus_error *error) { Unit *u; int r; @@ -2410,6 +2431,7 @@ const sd_bus_vtable bus_manager_vtable[] = { SD_BUS_PROPERTY("DefaultTimerAccuracyUSec", "t", bus_property_get_usec, offsetof(Manager, default_timer_accuracy_usec), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("DefaultTimeoutStartUSec", "t", bus_property_get_usec, offsetof(Manager, default_timeout_start_usec), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("DefaultTimeoutStopUSec", "t", bus_property_get_usec, offsetof(Manager, default_timeout_stop_usec), SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("DefaultTimeoutAbortUSec", "t", property_get_default_timeout_abort_usec, 0, 0), SD_BUS_PROPERTY("DefaultRestartUSec", "t", bus_property_get_usec, offsetof(Manager, default_restart_usec), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("DefaultStartLimitIntervalUSec", "t", bus_property_get_usec, offsetof(Manager, default_start_limit_interval), SD_BUS_VTABLE_PROPERTY_CONST), /* The following two items are obsolete alias */ |