From bfba3256a02a0871579c4ee48d787dfe4585fd8d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 17 Sep 2012 14:55:56 +0200 Subject: [PATCH] service: don't hit an assert if a service unit changes type and we get a spurious event from before --- TODO | 22 +++++----------------- src/core/service.c | 10 +++++----- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/TODO b/TODO index 6d5468a7e..10f43d7d2 100644 --- a/TODO +++ b/TODO @@ -22,23 +22,6 @@ Bugfixes: * we pull src/core/manager.h into src/shared/src/shared/path-lookup.c which is the wrong direction rename enum "ManagerRunningAs" to "SystemdRunningAs" and move it to shared/ -* crash happens when running a service as forking and then changing it to simple and reloading. - - Jul 09 18:20:57 mop systemd[1]: usbmuxd.service operation timed out. Terminating. - Jul 09 18:20:57 mop systemd[1]: Unit usbmuxd.service entered failed state. - Jul 09 18:22:24 mop systemd[1]: PID 21814 read from file /var/run/usbmuxd.pid does not exist. - Jul 09 18:22:24 mop systemd[1]: Unit usbmuxd.service entered failed state. - Jul 09 18:22:33 mop systemd[1]: Reloading. - Jul 09 18:22:37 mop systemd[1]: Assertion 's->type == SERVICE_FORKING' failed at src/core/service.c:3007, function service_sigchld_eve...Aborting. - Jul 09 18:22:37 mop systemd[1]: Caught , dumped core as pid 21865. - Jul 09 18:22:37 mop systemd[1]: Freezing execution. - Jul 09 18:22:37 mop [21866]: Process 21865 (systemd) dumped core. - -* support *static* (/run) hibernate inhibitors. All rpm -i actions should completely prevent any - sort of hibernate action until the next reboot. If the kernel or any other base tool is replaced - by rpm, the resume path might fail, the for resume needed kernel might even be uninstalled, and - the whole situation leads directly to data loss. - F18: * journald: warn if we drop messages we forward to the syslog socket @@ -55,6 +38,11 @@ F18: Features: +* support *static* (/run) hibernate inhibitors. All rpm -i actions should completely prevent any + sort of hibernate action until the next reboot. If the kernel or any other base tool is replaced + by rpm, the resume path might fail, the for resume needed kernel might even be uninstalled, and + the whole situation leads directly to data loss. + * move debug shell to tty6 and make sure this doesn't break the gettys on tty6 * move cryptsetup key caching into kernel keyctl? diff --git a/src/core/service.c b/src/core/service.c index 807b34267..7b5ff6d1a 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -2961,12 +2961,10 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { else service_enter_signal(s, SERVICE_FINAL_SIGTERM, f); break; - } else { - assert(s->type == SERVICE_DBUS || s->type == SERVICE_NOTIFY); - - /* Fall through */ } + /* Fall through */ + case SERVICE_RUNNING: service_enter_running(s, f); break; @@ -3036,7 +3034,9 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { break; case SERVICE_START: - assert(s->type == SERVICE_FORKING); + if (s->type != SERVICE_FORKING) + /* Maybe spurious event due to a reload that changed the type? */ + break; if (f != SERVICE_SUCCESS) { service_enter_signal(s, SERVICE_FINAL_SIGTERM, f); -- 2.30.2