Tested on v229. On Fri, Jun 10, 2016 at 3:37 PM, Shimin Guo <[email protected]> wrote:
> Summary: If bar depends on foo via Requires and After, a failed restart on > foo leaves bar permanently in the failed state, even if a later autorestart > successfully brings up foo, even if bar is configured to always restart. Is > this how systemd restart and dependency is supposed to work? > > To repro: > > foo.service: > > [Service] > Restart=always > RestartSec=5s > Type=notify > # sleep forever if /tmp/foo is present, otherwise fail > ExecStart=/usr/bin/bash -c "if [[ -e /tmp/foo ]]; then systemd-notify > --ready; while true; do sleep 99999; done; else exit 1; fi" > > bar.service > > [Unit] > Requires=foo.service > After=foo.service > > [Service] > Restart=always > RestartSec=5s > ExecStart=/usr/bin/bash -c "while true; do /usr/bin/sleep 99999; done" > > - Initially, both foo and bar are running. > - Then I rm'ed /tmp/foo and killed the main process for foo.service. > - Systemd noticed that foo is dead and attempted to restart it. > - In doing so, it stopped bar first, then foo. > - Then it tried to start foo but failed because /tmp/foo was missing. > - That put bar in a failed state with result 'dependency'. > - Systemd then tried to restart foo every 5 seconds. > - At this point I touched /tmp/foo, so foo started successfully. > - However, systemd didn't bother with starting bar at all in the restart > attempts after the first one. >
_______________________________________________ systemd-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/systemd-devel
