]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemd: rewatch pids under cgroup v1 when sigchld of processes more than main pid...
authorchenjiayi <chenjiayi22@huawei.com>
Wed, 18 Sep 2024 03:12:34 +0000 (11:12 +0800)
committerLennart Poettering <lennart@poettering.net>
Wed, 18 Sep 2024 08:13:20 +0000 (10:13 +0200)
If `Delegate` is configured in service, cgroup agent will never send out
any datagram as .control subcgroup is generated. Thus systemd will watch
all processes on the cgroup hierarchy for SIGCHLD to deal with unreliable
cgroup notifications.

In this way, systemd should rewatch all processes when any SIGCHLD is
captured, more than the control pid or main pid.

src/core/service.c

index ca1f54340d0ebc840b3e5636f04a97adda3cf8d9..e5db7a085b5f03761a6689221c995e0f3476f566 100644 (file)
@@ -4169,7 +4169,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
          * detect when the cgroup becomes empty. Note that the control process is always
          * our child so it's pointless to watch all other processes. */
         if (!control_pid_good(s))
-                if (!s->main_pid_known || s->main_pid_alien)
+                if (!s->main_pid_known || s->main_pid_alien || unit_cgroup_delegate(u))
                         (void) unit_enqueue_rewatch_pids(u);
 }