fix(chv): execd 单元 KillMode=process(构建 #6 驱动实证)
缺 KillMode 时 systemd 默认 control-group,kill -9 execd 主进程 后重启会 SIGTERM 整个 cgroup,sleep 任务同 pid 存活的要求被破、 新 execd 认领时 pid 已死记 unknown,驱动 kill 相断言失败。 KillMode=process 只信号主进程,任务在重启后同 pid 存活认领; stop 仍干净停 daemon 本身。回归测试 BuildWiringTest.test_build_sh_execd_unit_keeps_tasks_on_restart。
This commit is contained in:
1 parent
42adbd047f
commit
6a65c94254
2 files changed
+27
-1
No files matched your search
@@ -451,6 +451,25 @@ class BuildWiringTest(unittest.TestCase):
|
||||
'stat -c %a /etc/systemd/network/79-chv-cell.network',
|
||||
text)
|
||||
|
||||
def test_build_sh_execd_unit_keeps_tasks_on_restart(self):
|
||||
# 构建 #6 驱动实证:缺 KillMode 时 systemd 重启会杀整个
|
||||
# cgroup,sleep 任务同 pid 存活的要求被破。execd 单元须
|
||||
# KillMode=process;daemon/syncd 无长活子进程,不动。
|
||||
with open(_repo("chv-guest", "build.sh")) as fh:
|
||||
text = fh.read()
|
||||
execd = next(
|
||||
line for line in text.splitlines()
|
||||
if "chv-execd.service" in line
|
||||
and "Description=CHV guest exec daemon" in line)
|
||||
self.assertIn("KillMode=process", execd)
|
||||
self.assertEqual(execd.count("KillMode=process"), 1)
|
||||
for svc in ("chv-daemon", "chv-syncd"):
|
||||
block = next(
|
||||
line for line in text.splitlines()
|
||||
if "%s.service" % svc in line
|
||||
and "Description=" in line)
|
||||
self.assertNotIn("KillMode", block)
|
||||
|
||||
def test_lockfile_and_buildinfo_declare_services(self):
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
"stage2_buildinfo",
|
||||
|
||||
Reference in new issue
Block a user