[systemd-devel] Services remain in "deactivating" state after all processes have exited and cgroup is empty

Colin Guthrie gmane at colin.guthr.ie
Wed Sep 18 16:54:31 PDT 2013


Hi,

So recently (not sure if just since 207 or if it happened also for me
with 206), but I've noticed that some services don't detect when they
have stopped and remain in deactivating state until they timeout.

e.g.:

[root at jimmy ~]# systemctl stop httpd.service&
[1] 4042
[root at jimmy ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/etc/systemd/system/httpd.service; enabled)
   Active: deactivating (stop-sigterm) since Thu 2013-09-19 00:18:51
BST; 39s ago
  Process: 4044 ExecStop=/usr/sbin/httpd $OPTIONS -k graceful-stop
(code=exited, status=0/SUCCESS)
 Main PID: 2369
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:
  0 B/sec"
   CGroup: /system.slice/httpd.service

Sep 19 00:18:26 jimmy systemd[1]: Got notification message for unit
httpd.service
Sep 19 00:18:26 jimmy systemd[1]: httpd.service: Got message
Sep 19 00:18:26 jimmy systemd[1]: httpd.service: got STATUS=Total
requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec
Sep 19 00:18:36 jimmy systemd[1]: Got notification message for unit
httpd.service
Sep 19 00:18:36 jimmy systemd[1]: httpd.service: Got message
Sep 19 00:18:36 jimmy systemd[1]: httpd.service: got STATUS=Total
requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec
Sep 19 00:18:46 jimmy systemd[1]: Got notification message for unit
httpd.service
Sep 19 00:18:46 jimmy systemd[1]: httpd.service: Got message
Sep 19 00:18:46 jimmy systemd[1]: httpd.service: got STATUS=Total
requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec
Sep 19 00:18:51 jimmy systemd[1]: Stopping The Apache HTTP Server...
Sep 19 00:18:51 jimmy systemd[4044]: Executing: /usr/sbin/httpd -k
graceful-stop
[root at jimmy ~]# ps aux | grep [h]ttpd
root      4042  0.0  0.0  38392  1052 pts/0    S+   00:18   0:00
systemctl stop httpd.service
[root at jimmy ~]# ps aux | grep [2]369
[root at jimmy ~]#

As you can see, no processes are listed, thus it seems the cgroup is
empty and the stated MainPID is also gone (which is expected as the
cgroup is empty, but I wanted to check explicitly).



I do have the following my my httpd.service which may affect things, but
this is the same as the current fedora httpd.service, so I'm guessing
you guys will be affected by this too.

...
ExecStop=/usr/sbin/httpd $OPTIONS -k graceful-stop
# We want systemd to give httpd some time to finish gracefully, but
still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here
to give
# httpd time to finish.
# See https://bugzilla.redhat.com/show_bug.cgi?id=912288
# and https://bugzilla.redhat.com/show_bug.cgi?id=952634
KillSignal=SIGCONT
...

It could be that something semi-recent has resulted in breakage of this fix.

Anyone know anything of the top of their head?

Col
-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list