Skip to content

Cancelling, deleting or quitting during a video export does not always stop it #790

Closed

Description

@thcp

What goes wrong

Three gaps let a video export keep running after the person asked it to stop. (1) The cancel and delete checks are not made while the server tests encoders before the render (up to about two minutes on Linux). (2) run_video_render starts ffmpeg without first checking whether the render was cancelled. (3) On Windows, the desktop app stops the backend by killing it, so the shutdown code that cancels running renders never runs.

Who is affected

Anyone who cancels or deletes a take right after pressing Export, and Windows desktop users who quit during an export.

How to see it

  1. Press Export MP4 on a take, then press Cancel at once (or delete the take, or the song).
  2. On a machine where the encoder test is not cached, the test still runs to its end before the cancel is seen.
  3. On Windows desktop, quit the app while a video is being made. ffmpeg may continue for up to the render timeout (60 minutes) and leave a temporary file.

Evidence

  • app/api/takes.py:1531-1535 runs video_encoder.choose in a thread with no cancel hook.
  • app/pipeline/take_render.py:545 creates the process; the first cancelled() check is at :576, inside the polling loop.
  • app/main.py:272-274 cancels renders in the lifespan shutdown.
  • desktop/src-tauri/src/main.rs:3770-3804 (stop_backend) sends SIGTERM and waits only on Unix; on Windows it goes straight to child.kill().
  • Whether ffmpeg outlives its parent on Windows has not been run.

Constraints for anyone fixing it

  • A change to main.rs changes the desktop shell binary. Read desktop-update-gate first: it can send every desktop install to a full download instead of an in-app update.
  • Windows, macOS and Linux behave differently here; only Unix has a graceful stop today.
  • Startup already sweeps stale render temp files (take_render.py:505), which limits the damage of a hard kill.

Origin

NEW in 0.21.0 (the render path, 6504500); the Windows quit path is older. Found on the big-release branch (draft pull request #784); the work is not released yet.

Possible direction

Check the cancel flag before spawning ffmpeg and between probe candidates. For Windows, ask the backend to cancel renders over HTTP before the kill, or put ffmpeg in a job object that ends with the backend.

Verified by

read; the Windows effect is INFERRED, not run.

Activity

  1. added
    bugSomething isn't working
    reliabilityStability, resource management, race conditions
    on Oct 11, 2026
  2. self-assigned this
    on Oct 11, 2026
  3. added a commit that references this issue on Oct 14, 2026
    035cd7e
  4. thcp commented on Oct 18, 2026

    @thcp
    CollaboratorAuthor

    Fixed: cancelling, deleting or quitting now stops the encoder test, the wait on its lock, and the ffmpeg start (a cancelled render never starts ffmpeg), and a Windows kill-on-close job object stops ffmpeg after a quit. The Python side has tests that fail without the fix. The Windows job object is not yet run on a Windows host, tracked in the 0.21.0 release checklist (#795). On big-release, ships in 0.21.0.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingreliabilityStability, resource management, race conditions

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions