systemd / systemd/systemd

Reset backoff time of `RestartSteps=` after time or successful unit start

Open
#43,813 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pid1 RFE 🎁
Dominant language
C
Stars
16.7k
Forks
4.7k
Avg merge
1d 6h
Merged PRs (30d)
140

Description

Component

systemd

Is your feature request related to a problem? Please describe

systemd v254 introduces the RestartSteps= property. It solves the problem in #6129 perfectly and allows administrators to restart services with an exponential backoff. However, unlike other solutions like Kubernetes, which do have an exponential backoff between restarts as well, systemd doesn't reset the backoff values automatically, not even on a successful start. This has to be done manually by the administrator via systemctl reset-failed.

If a unit fails and gets restarted regularly but rarely (e.g once a month), it will always be restarted with the maximum backoff time. This specific example is mentioned in https://github.com/systemd/systemd/issues/6129#issuecomment-1620861743, the overall problem however is mentioned across other issues as well, e.g. #30804, this blog post by Chris Siebenmann.

Describe the solution you'd like

Personally, I think that the backoff counter should be reset as soon as the unit starts successfully. The linked issues also mention a reset after a given time, configurable by the user.

This would align it with other solutions like Kubernetes, where the backoff behaviour is implemented in a similar fashion.

Describe alternatives you've considered
  1. Set the RestartMaxDelaySec= property to a low value, e.g. 30s. This contradicts the idea of the exponential backoff a bit, since it only makes sense to set the RestartSteps= low as well, e.g. 5. Otherwise, I don't benefit that much from the backoff.
  2. Skip RestartSteps= completely and use a static restart policy every n seconds by setting StartLimitIntervalSec=0 and RestartSec=n.
The systemd version you checked that didn't have the feature you are asking for

261 (261.3-1-arch)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing systemd's implementation of the RestartSteps= and RestartMaxDelaySec= properties, using the existing systemctl reset-failed behavior as a reference point. Define and validate when the backoff resets—after a successful unit start, after a configurable interval, or both—and ensure the resulting behavior matches the requested Kubernetes-like restart semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.