dbus-daemon: systemd activation failures are not detected
To reproduce
Steps to reproduce the behavior:
$ cat ~/.local/share/dbus-1/services/com.github.amezin.false.service
[D-BUS Service]
Name=com.github.amezin.false
Exec=false
SystemdService=dbus-com.github.amezin.false.service
$ cat ~/.local/share/systemd/user/dbus-com.github.amezin.false.service
[Service]
Type=dbus
BusName=com.github.amezin.false
ExecStart=false
$ dbus-send --session --dest=org.freedesktop.DBus --print-reply --reply-timeout=1000000 /org/freedesktop/DBus org.freedesktop.DBus.StartServiceByName string:'com.github.amezin.false' uint32:0
Error org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'com.github.amezin.false': timed out (service_start_timeout=120000ms)
Expected result
systemd unit fails (almost) immediately, so I expect dbus-daemon to report the failure.
Actual result
Waiting for 2 minutes, then Error org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'com.github.amezin.false': timed out (service_start_timeout=120000ms)
.
So if I fix the issue that prevented the service from starting, there is up to 2 minute delay before the next activation attempt.
Additional context
dbus-broker handles this better - reports the failure immediately.
It seems that systemd doesn't send ActivationFailure
in this case - checked using dbus-monitor
, and also by looking at systemd code. systemd seems to send ActivationFailure
only when it can't even begin the activation (like if the unit name is incorrect). So this may be called a systemd bug... But dbus-broker somehow handles this better.
Similar systemd issue: https://github.com/systemd/systemd/issues/21520