Bug 89087 - Restart policy not applied to service that Requires another and ExecStop fails
Summary: Restart policy not applied to service that Requires another and ExecStop fails
Status: NEW
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-11 19:02 UTC by Brian Waldon
Modified: 2015-04-27 16:34 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Brian Waldon 2015-02-11 19:02:12 UTC
1. place the following units in the systemd search path:

# /etc/systemd/system/foo.service
[Unit]
Requires=bar.service

[Service]
Restart=always
RestartSec=10s
ExecStart=/usr/bin/bash -c "sleep 10; exit 255"
ExecStop=/usr/bin/bash -c "exit 1"

# /etc/systemd/system/bar.service
[Unit]
BindsTo=foo.service
After=foo.service

[Service]
ExecStart=/usr/bin/sleep infinity

2. Run systemctl start foo.service. foo.service and bar.service will both enter the loaded/active state

3. After 10s, foo.service will enter the loaded/failed state, while bar.service will enter loaded/inactive. The the Restart policy of foo.service should be applied, but it is not, and foo.service remains inactive until a user intervenes.

If you reattempt the above steps after removing either the Requires or the ExecStop options from foo.service, however, the Restart policy will be applied successfully. I expected the Restart policy to be applied even with the ExecStop/Requires options.

For reference:

$ systemctl --version
systemd 218
-PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP -GCRYPT -GNUTLS -ACL -XZ -LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD -IDN
Comment 1 Sukrit 2015-02-17 04:45:54 UTC
+1 for fix for this issue.
Comment 2 Bráulio Barros de Oliveira 2015-04-27 16:34:45 UTC
not working here two with a simpler sddm service (systemd 219). sddm is crashing and core dumping ramdonly due to a driver problem

[Service]
ExecStart=/usr/bin/sddm
Restart=always
RestartSec=5


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.