core/service: Type=notify/dbus services shouldn't be considered active

when ExitType=cgroup and main process exits

Follow-up for ef4300654e
This commit is contained in:
Mike Yuan
2024-03-05 10:45:49 +08:00
parent e0270bab43
commit 1651ce09c0
+4 -2
View File
@@ -3877,11 +3877,13 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
default:
assert_not_reached();
}
} else if (s->exit_type == SERVICE_EXIT_CGROUP && s->state == SERVICE_START)
} else if (s->exit_type == SERVICE_EXIT_CGROUP && s->state == SERVICE_START &&
!IN_SET(s->type, SERVICE_NOTIFY, SERVICE_NOTIFY_RELOAD, SERVICE_DBUS))
/* If a main process exits very quickly, this function might be executed
* before service_dispatch_exec_io(). Since this function disabled IO events
* to monitor the main process above, we need to update the state here too.
* Let's consider the process is successfully launched and exited. */
* Let's consider the process is successfully launched and exited, but
* only when we're not expecting a readiness notification or dbus name. */
service_enter_start_post(s);
}