test(parser): treat reaped container zombies as terminated
CI and Deploy / test (push) Failing after 52s
CI and Deploy / deploy (push) Has been skipped

This commit is contained in:
cesnimda
2026-08-31 22:14:37 +02:00
parent 789f30b6e6
commit e508fb9541
+11
View File
@@ -738,6 +738,17 @@ def test_parser_timeout_terminates_descendants(monkeypatch, tmp_path):
except ProcessLookupError: except ProcessLookupError:
pass pass
else: else:
# Minimal CI containers may not run an init process that promptly
# reaps orphaned children. A zombie has already been terminated and
# cannot execute or retain parser resources, even though kill(pid, 0)
# continues to see its process-table entry.
stat_path = Path(f"/proc/{descendant_pid}/stat")
try:
state = stat_path.read_text(encoding="ascii").split()[2]
except (FileNotFoundError, IndexError, OSError):
state = None
if state == "Z":
return
os.kill(descendant_pid, 9) os.kill(descendant_pid, 9)
raise AssertionError("Parser descendant survived the parent deadline") raise AssertionError("Parser descendant survived the parent deadline")