[systemd-devel] Zombie process still exists after stopping gdm.service

Daniel Drake drake at endlessm.com
Mon Apr 20 07:54:10 PDT 2015


On Mon, Apr 20, 2015 at 8:24 AM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Sun, 19.04.15 09:34, Andrei Borzenkov (arvidjaar at gmail.com) wrote:
>
>> В Fri, 17 Apr 2015 14:04:18 -0600
>> Daniel Drake <drake at endlessm.com> пишет:
>>
>> > Hi,
>> >
>> > I'm investigating why "systemctl stop gdm; Xorg" usually fails. The
>> > new X process complains that X is still running.
>> >
>> > Here's what I think is happening:
>> >
>> > 1. systemd sends SIGTERM to gdm to stop the service
>> >
>> > 2. gdm exits - it has a simple SIGTERM handler which just quits the
>> > mainloop without doing any cleanup (as far as I can see, it doesn't
>> > make any attempt to kill the child X server)
>> >
>> > 3. X exits because of PR_SET_PDEATHSIG (i.e. it's set to be
>> > automatically killed when the parent goes away). The killed process
>> > enters defunct state and is reparented to PID 1, presumably also
>> > moving it out of the gdm cgroup.
>> >
>>
>> No, it remains in cgroup. Otherwise systemd service management would
>> not be possible at all ...
>>
>> > 4. systemd notes that gdm's cgroup is empty and decides that gdm is
>> > now successfully stopped.
>> >
>>
>> I looked at display-manager.service here and it sets KillMode=process.
>> That is better explanation to your observation.
>
> Hmm, it does? It does not on Fedora. Also "display-manager.service" is
> just an alias to "gdm.service" on Fedora.
>
> Daniel, can you check with "systemctl cat gdm" what your distro
> configures there?

gdm git does have KillMode=mixed, but the slightly old gdm I'm running
here also does not have any KillMode assignment.

I'm investigating further at the moment. I've found a mistake in what
I wrote earlier - when gdm receives SIGTERM it *does* do a
kill/waitpid() on the child X server.
However the process seems to disappear before waitpid() returns -
currently trying to understand why. Ideas welcome.

Thanks for the help.
Daniel


More information about the systemd-devel mailing list