Bug#746151: systemd: daemon-reload+reload kills a daemon with a BusName
Josselin Mouette
joss at debian.org
Sun Apr 27 14:20:09 BST 2014
Package: systemd
Version: 204-8
Severity: normal
Hi,
the gdm.service file goes:
[Unit]
Description=GNOME Display Manager
Conflicts=getty at tty7.service plymouth-quit.service
After=systemd-user-sessions.service getty at tty7.service
plymouth-quit.service
[Service]
ExecStartPre=/bin/sh -c '[ "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/gdm3" ]'
ExecStartPre=/usr/share/gdm/generate-config
ExecStart=/usr/sbin/gdm3
ExecReload=/bin/kill -HUP $MAINPID
ExecReload=/usr/share/gdm/generate-config
Restart=always
RestartSec=1s
IgnoreSIGPIPE=no
BusName=org.gnome.DisplayManager
StandardOutput=syslog
StandardError=inherit
Running "systemctl reload gdm.service" works as expected. The two reload
processes are run successfully.
However, running in succession:
systemctl daemon-reload
# Wait whatever time you want
systemctl reload gdm.service
Makes the daemon receive a SIGTERM from PID 1.
First of all, the daemon is actually reloaded:
avril 27 14:32:24 kagura systemd[1]: Trying to enqueue job gdm.service/reload/replace
avril 27 14:32:24 kagura systemd[1]: Installed new job gdm.service/reload as 3926
avril 27 14:32:24 kagura systemd[1]: Enqueued job gdm.service/reload as 3926
avril 27 14:32:24 kagura systemd[1]: Reloading GNOME Display Manager.
avril 27 14:32:24 kagura systemd[1]: About to execute: /bin/kill -HUP $MAINPID
avril 27 14:32:24 kagura systemd[1]: Forked /bin/kill as 4066
avril 27 14:32:24 kagura systemd[1]: gdm.service changed running -> reload
avril 27 14:32:24 kagura systemd[1]: Child 4066 belongs to gdm.service
avril 27 14:32:24 kagura systemd[1]: gdm.service: control process exited, code=exited status=0
avril 27 14:32:24 kagura systemd[1]: gdm.service running next control command for state reload
avril 27 14:32:24 kagura systemd[1]: Forked /usr/share/gdm/generate-config as 4068
avril 27 14:32:24 kagura systemd[4068]: Executing: /usr/share/gdm/generate-config
avril 27 14:32:24 kagura gdm3[3731]: Got HUP signal
avril 27 14:32:24 kagura gdm3[3731]: GLib-GObject: g_object_ref: assertion 'G_IS_OBJECT (object)' failed
avril 27 14:32:24 kagura gdm3[3731]: GLib-GObject: invalid unclassed pointer in cast to 'GdmSettings'
avril 27 14:32:24 kagura gdm3[3731]: Settings Direct Init
The last lines are from GDM which correctly receives SIGHUP as intended
and does what it is supposed to do.
After which, things don’t go so well:
avril 27 14:32:24 kagura systemd[1]: Child 4068 belongs to gdm.service
avril 27 14:32:24 kagura systemd[1]: gdm.service: control process exited, code=exited status=0
avril 27 14:32:24 kagura systemd[1]: gdm.service got final SIGCHLD for state reload
avril 27 14:32:24 kagura systemd[1]: gdm.service changed reload -> stop-sigterm
avril 27 14:32:24 kagura systemd[1]: gdm.service's D-Bus name org.gnome.DisplayManager no longer registered by :1.186
avril 27 14:32:25 kagura systemd[1]: gdm.service holdoff time over, scheduling restart.
avril 27 14:32:25 kagura systemd[1]: Trying to enqueue job gdm.service/restart/fail
avril 27 14:32:25 kagura systemd[1]: Installed new job gdm.service/restart as 3927
avril 27 14:32:25 kagura systemd[1]: Enqueued job gdm.service/restart as 3927
avril 27 14:32:25 kagura systemd[1]: gdm.service scheduled restart job.
avril 27 14:32:25 kagura systemd[1]: Stopping GNOME Display Manager...
avril 27 14:32:25 kagura systemd[1]: gdm.service changed auto-restart -> dead
avril 27 14:32:25 kagura systemd[1]: Job gdm.service/restart finished, result=done
avril 27 14:32:25 kagura systemd[1]: Converting job gdm.service/restart -> gdm.service/start
avril 27 14:32:25 kagura systemd[1]: Starting GNOME Display Manager...
avril 27 14:32:25 kagura systemd[1]: About to execute: /bin/sh -c '[ "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/gdm3" ]'
avril 27 14:32:25 kagura systemd[1]: Forked /bin/sh as 4075
avril 27 14:32:25 kagura systemd[1]: gdm.service changed dead -> start-pre
avril 27 14:32:25 kagura systemd[1]: Child 4075 belongs to gdm.service
avril 27 14:32:25 kagura systemd[1]: gdm.service: control process exited, code=exited status=0
avril 27 14:32:25 kagura systemd[1]: gdm.service running next control command for state start-pre
avril 27 14:32:25 kagura systemd[1]: Child 4080 belongs to gdm.service
avril 27 14:32:25 kagura systemd[1]: gdm.service: control process exited, code=exited status=0
avril 27 14:32:25 kagura systemd[1]: gdm.service got final SIGCHLD for state start-pre
avril 27 14:32:25 kagura systemd[1]: About to execute: /usr/sbin/gdm3
avril 27 14:32:25 kagura systemd[1]: Forked /usr/sbin/gdm3 as 4083
avril 27 14:32:25 kagura systemd[1]: gdm.service changed start-pre -> start
avril 27 14:32:25 kagura systemd[4083]: Executing: /usr/sbin/gdm3
After which the new daemon is started with success:
avril 27 14:32:25 kagura gdm3[4083]: Enabling debugging
avril 27 14:32:25 kagura gdm3[4083]: Changing user:group to Debian-gdm:Debian-gdm
avril 27 14:32:25 kagura systemd[1]: gdm.service's D-Bus name org.gnome.DisplayManager now registered by :1.222
avril 27 14:32:25 kagura systemd[1]: gdm.service changed start -> running
avril 27 14:32:25 kagura systemd[1]: Job gdm.service/start finished, result=done
avril 27 14:32:25 kagura systemd[1]: Started GNOME Display Manager.
avril 27 14:32:25 kagura gdm3[4083]: Successfully connected to D-Bus
avril 27 14:32:25 kagura gdm3[4083]: GdmManager: GDM starting to manage displays
The actual commands used for reloading don’t matter: replacing them with
/bin/true yields the same result.
However, removing the BusName=org.gnome.DisplayManager in gdm.service
fixes the issue (although in this case I lose systemd tracking of the
DBus service becoming available).
More information about the Pkg-systemd-maintainers
mailing list