Skip to content

Auto-restart salt-minion.service on crash (#69182) - #69671

Open
dwoz wants to merge 1 commit into
saltstack:3006.xfrom
dwoz:fix/issue-69182
Open

Auto-restart salt-minion.service on crash (#69182)#69671
dwoz wants to merge 1 commit into
saltstack:3006.xfrom
dwoz:fix/issue-69182

Conversation

@dwoz

@dwoz dwoz commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds Restart=on-failure, RestartSec=15, StartLimitBurst=3, and
StartLimitIntervalSec=300 to the shipped pkg/common/salt-minion.service
systemd unit so that a crashed minion (unhandled exception, worker OOM,
etc.) is revived by systemd instead of being left in the failed state.

What issues does this PR fix or reference?

Fixes #69182

Related: #68406 (the recent KillMode=mixed fix on the same file — this
PR extends the tests/pytests/unit/test_pkg_systemd_units.py static
audit added there).

Previous Behavior

The shipped unit had no Restart=/RestartSec=/StartLimit* directives.
When the salt-minion process crashed the unit went to failed and
stayed there until someone ran systemctl start salt-minion by hand. As
the reporter observed on 3008.0rc4 (Ubuntu 22.04) and a second contributor
confirmed on 3007.14 (Rocky 9), an unhandled exception took the minion
offline from the master's point of view until the next manual intervention.

New Behavior

Restart=on-failure + RestartSec=15 in [Service] cause systemd to
restart the minion 15 seconds after a non-clean exit. StartLimitBurst=3

  • StartLimitIntervalSec=300 in [Unit] cap the loop at three restart
    attempts per five minutes so a persistent crash cannot hammer the box.

StartLimitBurst / StartLimitIntervalSec are intentionally placed in
[Unit]systemd-analyze verify rejects them in [Service] with
Unknown key 'StartLimitIntervalSec' in section [Service], ignoring.,
and [Unit] is systemd's canonical section for these directives.

Merge requirements satisfied?

Commits signed with GPG?

Yes

The shipped pkg/common/salt-minion.service systemd unit had no
Restart=/RestartSec=/StartLimit* directives. When the minion crashed
(unhandled exception, worker OOM, etc.) the unit stayed in the failed
state until someone logged in and ran systemctl start salt-minion,
leaving the host offline from the master's point of view for as long
as it took a human to notice.

Ask systemd to restart on failure with a 15-second gap between
attempts and a 3-attempts-in-5-minutes cap so a persistent crash
loop cannot hammer the box. StartLimitBurst and StartLimitIntervalSec
live in [Unit] (systemd rejects them in [Service] with
"Unknown key ... in section [Service], ignoring."); Restart and
RestartSec live in [Service].

Extend the existing static-file audit in
tests/pytests/unit/test_pkg_systemd_units.py (added alongside the
KillMode=mixed fix in saltstack#68406) to assert the new directives are set
and cannot silently regress.

Fixes saltstack#69182
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants