mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3059] [Issue]: RunPod ComfyUI generation ignores request.signal — the poll loop and provider fetches are not cancellable #1627
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1627
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3059
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
generateRunPodComfyUInever observesrequest.signal(the caller's abort / thewithImageGenerationDeadlinecontroller). The submit fetch and every status-poll fetch use a freshAbortSignal.timeout(30_000), and the inter-poll delay is a baresetTimeoutwith no abort listener. So when a caller aborts (e.g. game-asset generation passesreq.signal), the RunPod job keeps being polled and re-fetched for up toRUNPOD_MAX_POLLS(90) x 2s = 3 minutes. The awaited promise insidePromise.race([run, deadline])cannot settle early on abort, so a user/game cancel does not stop the work. Every other backend in the subsystem threads the signal through; RunPod is the lone exception.How to reproduce (try it yourself)
runpod_comfyuiimage connection.req.signal).IN_QUEUE/IN_PROGRESS.You'll see: status-poll requests keep firing every 2s and the call does not return until the job completes or RunPod's internal 3-minute cap is reached — the cancellation is ignored.
Expected: an abort settles the call promptly and aborts any in-flight submit/status fetch.
Where it is
packages/server/src/services/image/runpod-comfyui.service.ts:signal: AbortSignal.timeout(30_000).await new Promise((r) => setTimeout(r, runPodPollIntervalMs())), no abort.signal: AbortSignal.timeout(30_000).request.signal.For contrast, local ComfyUI uses
sleepWithAbort(1000, request.signal)andimageRequestSignal(request)(image-generation.ts:2116/2135/2138/2167); A1111/Stability/Horde/etc. all threadimageRequestSignal(request).ImageGenRequest.signalis set bywithImageGenerationDeadline(image-generation.ts:162-167).What's happening
The poll delay uses an abort-unaware
setTimeout, and each fetch builds its ownAbortSignal.timeout(30_000)instead of combining withrequest.signal. Because thePromise.raceonly settles early ifrunreacts to the signal, andgenerateRunPodComfyUIignores it, an external abort does not stop the loop.Suggested fix
Thread
request.signalinto both fetches and the poll delay using self-contained local helpers (sleepWithAbort/imageRequestSignal/throwIfAbortedare NOT exported from image-generation.ts, so do not import them — that would failpnpm check):runPodFetch:signal: AbortSignal.timeout(30_000)->signal: runPodFetchSignal(request).setTimeoutdelay withawait runPodSleep(runPodPollIntervalMs(), request.signal);, and usesignal: runPodFetchSignal(request)on the status fetch.runPodSleeprejecting on abort makes the awaited race settle promptly with the deadline/caller reason; the combined fetch signal aborts in-flight requests. Keep the 2s interval, the 90-poll cap, and all error strings unchanged.Regression avoided: the original suggestion said to reuse
sleepWithAbort/imageRequestSignal, but those are not exported and importing them breaks the build — hence the self-contained local helpers. The no-signal direct-call path falls back to plainAbortSignal.timeout(30_000), mirroringimageRequestSignal'srequest.signal ?? AbortSignal.timeout(...)semantics.AbortSignal.anyis available (Node 24) and already used elsewhere;safeFetchspreads...initso the signal threads through. The change is isolated to this file and only adds signal observation.AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Claiming this for the current staging sweep in draft PR #3064: https://github.com/Pasta-Devs/Marinara-Engine/pull/3064
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed in PR #3064 on branch
codex/issue-sweep-3054-3063(commit3ae8ca37). Closing this issue as addressed; the PR remains open for staging review/merge.