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

Lennart Poettering lennart at poettering.net
Mon Apr 20 07:23:03 PDT 2015


On Fri, 17.04.15 14:04, Daniel Drake (drake at endlessm.com) wrote:

> I'm investigating why "systemctl stop gdm; Xorg" usually fails. The
> new X process complains that X is still running.

Have you checked what precisely fails? What's the error message you
are getting? What is the actual failing routine?

> 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.

zombie processes indeed do not belong to any cgroup anymore. 

> 4. systemd notes that gdm's cgroup is empty and decides that gdm is
> now successfully stopped.

Note that SIGCHLD is processed with higher prorirty that cgroup empty
events by systemd. This means that if both are queued, SIGCHLD and
reaping of the PIDs should always happen first.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list