Detect and recover a stalled prompt worker in self-hosted ComfyUI

Open
#18,061 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
python, pytorch
Domain
ai, backend

Research direction

Read the worker startup code in main.py around lines 630–633 and post-prompt cleanup around lines 432–436, then reproduce the reported stall with the described event-based fault injection. The issue asks maintainers to choose between Core worker supervision and launcher or proxy responsibility, so it does not define an implementation or completion criteria yet.

Written by the indexing model from the issue text.

Description

Feature Idea

Expose worker health and an opt-in recovery deadline for self-hosted ComfyUI. A workflow or its cleanup can trigger a stall. With the current single prompt worker, that stall can prevent every later prompt from starting. Serial execution on a GPU is compatible with this request.

In a Kubernetes deployment, we have seen the entire ComfyUI API stop responding before the container restarts. We no longer have the incident logs, so we cannot attribute those restarts to an OOM kill, a probe failure, or a particular node.

Separately, I tested the queue behavior with fault injection against upstream commit 7c78b5641ab2. In a local harness, I let prompt A finish and made its post-prompt soft_empty_cache() wait on an event. Prompt B stayed pending while the GET /prompt handler still returned HTTP 200. Releasing the event let the worker proceed. This demonstrates how a live worker can block the queue. The production-wide API outage remains unverified in that test. Worker startup · Post-prompt cleanup

Existing Solutions

#16312 and #16317 cover exceptions that escape prompt execution and leave the queue without a worker. A worker can also stay alive indefinitely inside a call that never returns. The official API proxy's batch-workload docs describe persistent state outside Core, which can help preserve queued work across a restart.

Other

Is worker supervision intentionally a responsibility of the launcher or API proxy? What constraints have kept worker health or a configurable execution deadline out of Core so far?

A possible boundary is for Core to expose worker state and cooperate with prompt cancellation when safe. A supervisor could restart the process for a native hang, retain unstarted jobs in a durable queue, and mark the interrupted attempt failed without automatically replaying it. Is that the recovery model maintainers recommend, or would an opt-in Core feature be welcome?

Dominant language
Python
Stars
150k
Forks
17.9k
Avg merge
1d 1h
Merged PRs (30d)
181

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Comfy-Org/ComfyUI

All issues in Comfy-Org/ComfyUI

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.