Skip to content

fix(testing): judge::stale treats a zombie pid as alive #6865

Closed as not planned
Closed as not planned

Description

@kyle-sexton

judge::stale (plugins/testing/hooks/judge-lib.sh, around line 346) checks a pending marker's pid with kill -0, which succeeds for a zombie. When PID 1 never reaps orphans, as in a container started without --init, a killed job's marker looks alive, and the Stop hook waits out its whole 180 s deadline.

Evidence, from the investigation of #6719:

  • In a container whose PID 1 was plain sleep, the s7 case failed 3 times. The pending pid showed state=Z, ppid=1.
  • With docker --init, the same case failed 0 times in 42 runs.

Possible fix: treat a pid whose /proc/<pid>/stat state is Z as dead, falling back to kill -0 where /proc is absent.

Priority: low. It costs a 180 s wait only under a non-reaping PID 1.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TRhsMPSTMFo99ik7gkdgQt

Activity

  1. added
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Oct 10, 2026
  2. github-actions commented on Oct 10, 2026

    @github-actions
    Contributor

    Thanks for the detailed report. I confirmed judge::stale in plugins/testing/hooks/judge-lib.sh (line 346) relies on kill -0 "$pid", which does succeed for a zombie process, so under a non-reaping PID 1 (e.g. a container without --init) a killed job's marker can appear alive and the Stop hook waits out the full 180s deadline. The reproduction evidence (3/3 failures without --init, 0/42 with it) and the suggested fix (checking /proc/<pid>/stat for state Z, falling back to kill -0 where /proc is unavailable) both look sound. No duplicates found. Marked low priority as you noted, since it only costs a wait under this specific condition.

    Automated triage. A maintainer reviews it.

  3. removed
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Oct 12, 2026
  4. added theissue type on Oct 12, 2026
  5. kyle-sexton commented on Oct 13, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision (2026-10-13): approved the recommendation.

    • Is the bug still on main? → Yes. judge::stale treats a same-host holder as dead only when ! kill -0 "$pid" succeeds (judge-lib.sh:369, checked again 2026-10-13). No PR addresses it.
      Basis: origin/main plugins/testing/hooks/judge-lib.sh:358-371
    • Does kill -0 report a zombie as alive? → Yes. POSIX kill() does not return ESRCH for a zombie, and /proc//stat state Z marks one. The issue's own runs agree (3 of 3 failed without --init, 0 of 42 with it).
      Basis: https://pubs.opengroup.org/onlinepubs/9799919799/functions/kill.html; https://man7.org/linux/man-pages/man5/proc_pid_stat.5.html
    • Fix shape → When /proc/$pid/stat is readable, take the state character after the last ) and treat Z or X as dead; otherwise fall back to kill -0. Add a regression case to plugins/testing/hooks/test-judge.test.sh that fails before the fix, and bump the version and CHANGELOG.

    Next: an agent lane, via admission, opens one PR in plugins/testing; it changes a Stop-hook library, so a human merges it.

    This was generated by AI.

  6. kyle-sexton commented on Oct 13, 2026

    @kyle-sexton
    MemberAuthor

    Owner batch-ratified this admission in an attended session on 2026-10-12: work-class: scoped. Rule: class C1-C3, no trust surface, the independent check confirmed the recorded decision, and no owner step remains.

  7. added
    work-class: scopedA briefed fix or small feature; blast radius bounded by the brief, tests exist.
    agent-readyFully specified and briefed; eligible for autonomous pickup from the frontier.
    and removed
    agent-readyFully specified and briefed; eligible for autonomous pickup from the frontier.
    on Oct 13, 2026
  8. kyle-sexton commented on Oct 18, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during backlog shaping.

    Closing as not planned. PR #7544 (merged 2026-10-16) moved the test judge off hooks and removed the test-judge Stop hook scripts this issue fixes; plugins/testing/hooks/judge-lib.sh:1-4 says no hook runs the library now.

    The owner approved this close in an attended backlog-shaping session on 2026-10-18 (question: "Close the 9 issues ...?"; answer: "Close all 9 (Recommended)").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: lowNice-to-have, cosmetic, or speculative; opportunistic.work-class: scopedA briefed fix or small feature; blast radius bounded by the brief, tests exist.

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions