Skip to content

Cancel does not stop in-flight GPU inference #20

Description

@taskmasterpeace

Severity: High (confirms a known issue, with precise location)

backend/handlers/video_generation_handler.py (~L269-285; A2V path ~L538-557).

pipeline_state.pipeline.generate(...) runs synchronously to completion. is_generation_cancelled() is checked only before (~L205) and after (~L282) inference — never during. cancel_generation() merely swaps state to GenerationCancelled; the in-flight generate() (the multi-minute/hour part) has no cancellation token and runs to the end. Same pattern in the API pollers.

Fix

Thread a cancellation callback / threading.Event into the pipeline's denoising loop so it can bail between diffusion steps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    auditFiled from the July 2026 auditbackendPython FastAPI backendbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions