<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Restart policy not applied to service that Requires another and ExecStop fails"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=89087">89087</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Restart policy not applied to service that Requires another and ExecStop fails
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>brian@waldon.cc
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>