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

Raman Gupta rocketraman at gmail.com
Mon Jan 31 14:47:19 UTC 2022


On Sun, Jan 30, 2022 at 5:54 AM Mantas Mikulėnas <grawity at gmail.com> wrote:

> On Sat, Jan 29, 2022 at 5:29 AM Raman Gupta <rocketraman at gmail.com> wrote:
>
>> Try to set the systemd user instance's log level to 'debug'; I'm guessing
>>> it's not that systemd kills processes directly but that something triggers
>>> a 'systemctl stop' of the session .scope that they were in.
>>
>>
>> Here are the logs at debug level with some annotations inline:
>>
>> *...*
>>
>
> Processes get SIGCHLD for all children that exit -- it's not suppressed
> just because the same process sent a SIGTERM recently.
>
>
>>
>> ...
>>
>
> 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?

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?


>
> For special cases like desktop environments, I think this means the
> .service should have KillMode=process (as long as that's still supported,
> anyway), *or* Plasma should be improved to no longer spawn apps directly
> but to put them in new systemd units (like gnome-shell does).
>

Makes sense. If I have time, I'll follow up with Plasma upstream regarding
this. I do want to make sure I understand what is going on though, so I can
file a good report.

Regards,
Raman



>
> --
> Mantas Mikulėnas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20220131/44ce9168/attachment.htm>


More information about the systemd-devel mailing list