[systemd-devel] Restart best practices

Lennart Poettering lennart at poettering.net
Thu Jun 5 10:00:51 PDT 2014


On Thu, 05.06.14 01:39, Marco d'Itri (md at Linux.IT) wrote:

> Should upstream packages and distributions use Restart=on-failure in 
> their default configuration unless there are package-specific reasons to 
> not do this?

That's a very good question. See this discussion regarding the Fedora
policy on this:

https://fedorahosted.org/fpc/ticket/191

I kinda dropped the ball on that one though, I can't say I enjoy working
with the FPC...

But anyway, I should probably resurrect this. I have now added a new
Restart=on-abnormal setting that was suggested in the FPC ticket. It
should be a good choice for the cases where Restart=on-failure is not
appropriate, the only difference being that Restart=on-abnormal doesn't
restart a service exiting with an exit code != 0, like
Restart=on-failure would do. It will still restart on timeout, core
dump, unclean signal, watchdog timeout though.

I think it would make sense to recommend that packagers and upstream
packages adopt Restart=on-failure or Restart=on-abnormal (where the
former is not appropriate) for all long-running daemons. However, this
recommendation should be taken with a grain of salt, as for some
services it might be a bad choice to just tape over problems and
restarting it again on failure... Hence, this is really not something to
blindly apply to all services on the world, but just a recommendation
that individually should be considered.

Note that for all long-running services we ship as part of systemd we
actually set Restart=always, as for them we know that a clean exit is
never possible, and they generally are so essential that the entire
system is fucked if they die and stay dead... At the same time all of
them (with the exception of udevd) are also hooked up with the watchdog
logic, to make them extra-reliable...

After the next systemd release I intend to reopen the FPC ticket again,
suggesting usage of Restart=on-{failure,abnormal}, unless I forget it
again...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list