Repository navigation
Auto-restart salt-minion.service on crash (#69182) - #69671
Merged
Merged
Conversation
twangboy
previously approved these changes
Jul 14, 2026
Contributor
|
We are no longer accepting bug fixes on the 3006.x branch. Please rebase against the 3008.x branch. |
twangboy
previously approved these changes
Oct 30, 2026
BrianHa94
previously approved these changes
Nov 10, 2026
dwoz
force-pushed
the
fix/issue-69182
branch
from
November 24, 2026 04:35
c97c8a1 to
c3745d9
Compare
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
The previous commit set ``StartLimitBurst=3`` inside a 5-minute window on the salt-minion unit as a crash-loop guard. That ceiling turns out to be below the number of start requests a normal operator or a CI ``pkg-system-service`` test session can issue within the same window: * install-time ``deb-systemd-invoke start`` * salt-factories ``factory.started()`` fixture start * any explicit ``systemctl start`` inside the test body Combined with the new ``Restart=on-failure``, ``StartLimitBurst=3`` caused the teardown ``systemctl start salt-minion`` in ``test_systemctl_stop_removes_proc_files`` to be refused with start-limit-hit; the session-scoped ``salt_minion`` fixture then stayed inactive and every downstream test that targets the minion failed with "Minion did not return. [No response]" on Ubuntu 24.04 / 26.04, Debian 13 arm64 and Photon OS 5 arm64 across the 3006.30 / 3007.17 / 3008.5 upgrade matrices. Raise ``StartLimitBurst`` to 10 (keeping the 300s window). A crashloop that trips 10 restarts in 5 minutes is still a hard fault systemd should refuse to keep hammering; the bound is still well below systemd's own ``DefaultStartLimit`` envelope for a persistent crash. The existing audit test only requires ``StartLimitBurst > 0``, so the change is fully compatible with the regression harness added for saltstack#69182. Also harden the graceful-stop test teardown with ``systemctl reset-failed salt-minion`` before the recovery start: this is the systemd-recommended way to clear accumulated start-limit and failed-state counters when a test intentionally stops+starts the unit, and keeps the suite resilient if other tests add further stop/start sequences in the same session.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds
Restart=on-failure,RestartSec=15,StartLimitBurst=3, andStartLimitIntervalSec=300to the shippedpkg/common/salt-minion.servicesystemd 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=mixedfix on the same file — thisPR extends the
tests/pytests/unit/test_pkg_systemd_units.pystaticaudit added there).
Previous Behavior
The shipped unit had no
Restart=/RestartSec=/StartLimit*directives.When the
salt-minionprocess crashed the unit went tofailedandstayed there until someone ran
systemctl start salt-minionby hand. Asthe 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=15in[Service]cause systemd torestart the minion 15 seconds after a non-clean exit.
StartLimitBurst=3StartLimitIntervalSec=300in[Unit]cap the loop at three restartattempts per five minutes so a persistent crash cannot hammer the box.
StartLimitBurst/StartLimitIntervalSecare intentionally placed in[Unit]—systemd-analyze verifyrejects them in[Service]withUnknown key 'StartLimitIntervalSec' in section [Service], ignoring.,and
[Unit]is systemd's canonical section for these directives.Merge requirements satisfied?
changelog/69182.fixed.md)Commits signed with GPG?
Yes