From: chenjiayi Date: Wed, 18 Sep 2024 03:12:34 +0000 (+0800) Subject: systemd: rewatch pids under cgroup v1 when sigchld of processes more than main pid... X-Git-Tag: v257-rc1~409 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4fc8a63f9e193e1c849dc3dc1abdc623db804770;p=thirdparty%2Fsystemd.git systemd: rewatch pids under cgroup v1 when sigchld of processes more than main pid and control pid is captured 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. --- diff --git a/src/core/service.c b/src/core/service.c index ca1f54340d0..e5db7a085b5 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -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); }