]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: add RestartRandomizedDelaySec= service option
authorMichael Vogt <michael@amutable.com>
Wed, 27 May 2026 16:32:04 +0000 (18:32 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 20 Jun 2026 10:31:28 +0000 (12:31 +0200)
commit046de3caeaa8fdfe6014ffdf23b2db6e4b6c60db
treef77078be3ef6f2e8e53572a44336321a3d8e46a4
parent23b0bd230b7848038001b2e0a5ce20aafcf19ffc
core: add RestartRandomizedDelaySec= service option

We already support exponential backoff for automatic restarts via
RestartSec=/RestartSteps=/RestartMaxDelaySec=, but there is no way to
randomize the restart delay. When many instances of a service fail at
the same time (e.g. because a shared resource briefly went away) they
are all restarted in lockstep, creating a thundering herd problem.

So this commit adds a simple `RestartRandomizedDelaySec=` service
option which is similar to the timer `RandomizedDelaySec=` and
adds a randomized restart delay.
man/org.freedesktop.systemd1.xml
man/systemd.service.xml
src/core/dbus-service.c
src/core/load-fragment-gperf.gperf.in
src/core/service.c
src/core/service.h
src/core/varlink-service.c
src/shared/bus-unit-util.c
src/shared/varlink-io.systemd.Unit.c
test/units/TEST-03-JOBS.sh