Repository navigation
fix(process_registry): drop OOMPolicy=kill from systemd scope units - #103762
aravindtri wants to merge 1 commit into
Conversation
systemd <250 (Ubuntu 20.04) rejects OOMPolicy=kill on scope units with 'Unknown assignment: OOMPolicy=kill', causing the availability probe to fail and making restart-safe cron dispatch a no-op. MemoryMax + MemoryAccounting still bound the worker cgroup; the kernel OOM killer applies. Fixes cron jobs not running on Ubuntu 20.04 / systemd 245.
crazyief
left a comment
There was a problem hiding this comment.
Please use GitHub Commit suggestion (not copy-paste / amend). That records Co-authored-by: crazyief.
Suggestion: add unit tests for the OOMPolicy removal
The PR removes OOMPolicy=kill from _systemd_scope_argv but has zero test coverage for this function. I verified these tests pass 4/4 on the lab against the PR worktree.
diff --git a/tests/tools/test_systemd_scope_argv.py b/tests/tools/test_systemd_scope_argv.py
new file mode 100644
--- /dev/null
+++ b/tests/tools/test_systemd_scope_argv.py
@@ -0,0 +1,38 @@
+"""Tests for _systemd_scope_argv OOMPolicy removal (#103762)."""
+
+from __future__ import annotations
+
+import pytest
+
+
+class TestSystemdScopeArgv:
+ """_systemd_scope_argv must produce valid systemd-run argv without
+ OOMPolicy=kill (systemd <250 rejects it on scope units)."""
+
+ def test_oom_policy_not_present(self):
+ from tools.process_registry import _systemd_scope_argv
+ argv = _systemd_scope_argv("systemd-run", "test-unit", "echo", "hello")
+ oom_flags = [a for a in argv if "OOMPolicy" in a]
+ assert len(oom_flags) == 0
+
+ def test_memory_properties_still_present(self):
+ from tools.process_registry import _systemd_scope_argv
+ argv = _systemd_scope_argv("systemd-run", "test-unit", "echo", "hello")
+ assert any("MemoryMax" in a for a in argv)
+ assert any("MemoryAccounting" in a for a in argv)
+
+ def test_includes_collect_and_unit(self):
+ from tools.process_registry import _systemd_scope_argv
+ argv = _systemd_scope_argv("systemd-run", "test-unit", "echo", "hello")
+ assert "--collect" in argv
+ assert "--unit" in argv
+ assert "test-unit" in argv
+
+ def test_passes_through_command(self):
+ from tools.process_registry import _systemd_scope_argv
+ argv = _systemd_scope_argv("systemd-run", "test-unit", "echo", "hello")
+ assert "echo" in argv
+ assert "hello" in argv
+```
|
Thanks @aravindtri — the Ubuntu 20.04 / systemd 245 evidence here is useful: it shows transient Closing as a duplicate of #102357 (@gkd2323c, opened 2026-09-03), which makes the same change — remove |
Problem
On Ubuntu 20.04 (systemd 245), cron jobs silently never run. The availability probe for restart-safe dispatch fails with:
systemd <250 rejects
OOMPolicy=killon--scopeunits.Fix
Remove
OOMPolicy=killfrom_systemd_scope_argv.MemoryMax+MemoryAccountingstill bound the worker cgroup, and the kernel OOM killer still applies — no memory-limit regression.Verification