Skip to content

fix(render): clean up failed and interrupted renders - #82

Open
Arav-Arun wants to merge 1 commit into
blixvip:mainfrom
Arav-Arun:fix/render-cleanup-49
Open

Arav-Arun wants to merge 1 commit into
blixvip:mainfrom
Arav-Arun:fix/render-cleanup-49

Conversation

@Arav-Arun

Copy link
Copy Markdown
Contributor

What does this change?

Closes #49.

Registers cleanup as each section's files, log handle and renderer are created. A failed launch or interrupted wait now closes the logs, removes temporary section HTML and frame caches, and stops and waits for started renderers. POSIX renderers use their own process group; Windows uses taskkill /T /F, with a parent-process kill fallback.

The existing non-zero exit message still includes the log tail. Successfully rendered and cached sections remain available for muxing and reuse.

How did you test it?

Tested on macOS with Python 3.13.5 and Node.js 25.1.0.

  • python -m unittest discover passes — 98 tests. The new launch-failure and interruption regressions fail against the original implementation.
  • python -m easyedit.doctor --json reports a ready machine.
  • Real render through render() and muxing: a four-second synthetic fixture produced two sections and a 1920×1080, 24 fps MP4 with audio. A second run reused both cached sections. Inputs used local system fonts, a test pattern and silent audio; no movie download or LLM stage was run.
  • UI changes checked in a real browser — not applicable; no UI changes.

The unit tests cover first and later launch failures, KeyboardInterrupt during a wait, non-zero exit log preservation, successful section retention, mocked Windows tree cleanup and a real POSIX child that ignores SIGTERM.

An additional real-renderer check injected a second-launch failure after Chrome started. The started Node process was reaped, the observed Chrome/FFmpeg descendants stopped, log handles closed, and temporary section files/caches were removed. Native Windows was not available; its cleanup path is mocked in the unit tests.

Checklist

  • One fix, kept focused on section-render cleanup
  • Used the easyedit/util.py helpers for the new external command (taskkill)
  • No new runtime dependency
  • Nothing committed from jobs/, .cache/, node_modules/, or any footage
  • README reviewed — no flags, setup instructions or usage changed

Register logs and temporary section files for cleanup as they are created.
Reap started renderers when a later launch fails or a wait is interrupted,
using process groups on POSIX and taskkill tree cleanup on Windows.

Preserve the existing non-zero exit log tail and successful cached sections.
Add regressions for launch failures, interruption, success and process-tree
cleanup, including a real child that ignores SIGTERM.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't leak log handles and orphan renderers when a section fails to start

1 participant