[systemd-devel] systemd killing processes on monitor wakeup?

Lennart Poettering lennart at poettering.net
Mon Jan 31 14:54:00 UTC 2022


On Mo, 31.01.22 09:47, Raman Gupta (rocketraman at gmail.com) wrote:

> > Honestly this just sounds like systemd killing "leftover" processes within
> > the plasma-plasmashell cgroup, after the "main" process of that service has
> > exited. That's not a bug; that's standard behavior for systemd services.
> >
>
> What determines whether a process becomes part of the plasma-plasmashell
> cgroup or not? When I run plasmashell independently of systemd, processes
> do indeed start as child processes of plasmashell. I'm guessing this
> implies that when plasmashell is run under systemd, all these processes
> become part of the cgroup, and this is why systemd "cleans up" all these
> child processes after a plasmashell crash?

I don't know plasma, but generally: whatever is forked off from a
process is part of the same cgroup as the process — unless it is
expicitly moved away. Moving things away explicitly is typically done
by PID 1 or the per-user instance of systemd, on explicit API
request.

So, don#t know if plasma calls into systemd at all. If it doesn't all
its children will be part of the same cgroup as plasma. If it otoh
does IPC calls to systemd in some form and tells it to fork/take over
the processes then they might end up in a different cgroup however.

>
> It's also interesting to me that many applications *do not* exit in this
> scenario -- Slack Desktop exits about 50% of the time, and IDEA exits
> pretty consistently. Most other apps remain running. Not sure why that
> would be -- if systemd is cleaning up, shouldn't all apps exit?

"systemd-cgls" should give you a hint which cgroups exists and which
processes remain children of plasma inside its cgroup, and which ones
got their own cgroup.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list