Skip to content

comfyui: stop and the reinstall guard trust a bare PID #547

Open

Description

@rominf

Current behavior

rocm comfyui start records only a PID. Two things trust that bare PID: rocm comfyui stop, and the --reinstall running guard from #546. They check it with kill -0 or tasklist, so if ComfyUI has exited and the PID has been reused:

  • stop can terminate an unrelated process tree.
  • The guard can refuse a reinstall because of someone else's process.

Separately, stop deletes the saved state after a short wait even when the process survives termination. That clears the guard while ComfyUI is still running.

Expected behavior

Identify ComfyUI by PID plus process start time, as rocm_core::proc_lifecycle already does for managed services, and never act on a process whose identity doesn't match. Keep the saved state when termination fails.

Possible solution

  • At start, record a ProcessIdentity.
  • In stop, use terminate_verified.
  • In the guard, use an identity check.

Related: #546, and the identity-verified stop work for rocmd in #499.

Activity

  1. jussielo-amd commented on Oct 27, 2026

    @jussielo-amd
    Collaborator

    Possibly related evidence: during the ROCMAI-86 (Phase 6f main.rs modularization) stack's local verification (cargo test --workspace --no-fail-fast, 2026-10-27), on a branch with no changes to comfyui.rs, this test intermittently failed:

    comfyui::tests::reinstall_is_refused_while_comfyui_starts_until_it_is_stopped — passed cleanly on an immediate isolated rerun. Given this issue's description of PID reuse causing the reinstall guard/stop path to misjudge a process's liveness, a test exercising "reinstall is refused while comfyui starts until it is stopped" seems like a plausible symptom of the same root cause, though I haven't traced the exact mechanism — flagging for whoever picks this up to judge, not asserting it's definitely the same bug.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions