Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused cron cleanup. The premise is confirmed on current origin/main: cron/scheduler.py:75-79 classifies the script runner's Script timed out ... result (cron/scheduler.py:2132-2133) as a provider timeout, and the runner uses a direct-child subprocess.run(..., timeout=...) path at cron/scheduler.py:2100-2108.
Problems
tests/cron/test_cron_script.py:230usesos.kill(child_pid, 0)to require the child PID to disappear. A successfully signaled, reparented descendant may remain an unreaped zombie, so this can fail after correct cleanup. Existing process-tree coverage explicitly treats dead-or-zombie as terminated intests/tools/test_process_registry.py:1928-1952.
Suggested changes
- Make the new descendant assertion zombie-aware, following the existing process-tree test pattern; retain the POSIX-only marker and cleanup guard.
Automated hermes-sweeper review.
| deadline = time.monotonic() + 5 | ||
| while time.monotonic() < deadline: | ||
| try: | ||
| os.kill(child_pid, 0) |
There was a problem hiding this comment.
os.kill(pid, 0) also succeeds for an unreaped zombie, so this can fail after successful killpg cleanup when the reparented child has not yet been reaped. Please use a zombie-aware probe, following tests/tools/test_process_registry.py:1928-1952.
Duplicate of #59379 — both fix #59549 with the same two-part change in |
Summary
Root cause
_summarize_cron_failure_for_deliverytreated any error containingtimeoutas a provider timeout, even when_run_job_scriptemittedScript timed out after ...for a no-agent job. The script runner also usedsubprocess.run(timeout=...), which could leave grandchildren alive after the direct child was killed.Verification
scripts/run_tests.sh tests/cron/test_cron_script.py tests/cron/test_run_one_job.py tests/cron/test_cron_no_agent.py -qgit diff --checkPlatform behavior
POSIX uses a dedicated session/process group with TERM then KILL fallback. Windows retains compatible direct-child cleanup.