Skip to content

fix(preview): prevent memory leak and CPU overhead in thumbnail generator by aborting video stream and adding timeout fallback #1505

Open
AdityaNarayanPadhi wants to merge 1 commit into
magic-peach:mainfrom
AdityaNarayanPadhi:fix-thumbnail-leak-1500
Open

fix(preview): prevent memory leak and CPU overhead in thumbnail generator by aborting video stream and adding timeout fallback #1505
AdityaNarayanPadhi wants to merge 1 commit into
magic-peach:mainfrom
AdityaNarayanPadhi:fix-thumbnail-leak-1500

Conversation

@AdityaNarayanPadhi
Copy link
Copy Markdown

Summary

This PR prevents memory leaks and background CPU overhead in the offscreen thumbnail generator caused by stalled seek operations when new videos are uploaded or components unmount (#1500).

Changes

  • Updated cancelThumbnailRun in ThumbnailStrip.tsx to immediately set the source of the offscreen video element to "" and invoke load(). This halts active media loading/decoding instantly and clears occupied hardware/software decoder slots.
  • Added a 2-second timeout fallback inside the offscreen canvas seek promise within generateThumbnails. If a seek stalls, the promise resolves and allows the loop to exit and clean up rather than hanging indefinitely.

Verification

  • Uploading new videos rapidly in succession or unmounting the component during thumbnail generation now aborts active seeks immediately, resolving memory footprint creep and background thread usage.

…ator by aborting video stream and adding timeout fallback (magic-peach#1500)
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

@AdityaNarayanPadhi is attempting to deploy a commit to the magic-peach1's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added level:beginner Beginner level - 20 pts type:bug Bug fix type:refactor Code refactor labels Jun 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

⚠️ PR Format Issues — @AdityaNarayanPadhi

Please fix the following before your PR can be reviewed:

  • ⚠️ No linked issue found. Add Closes #<issue-number> to your PR description.

Push new commits after fixing — this comment will update automatically.

📖 CONTRIBUTING.md

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

👋 Thanks for your PR, @AdityaNarayanPadhi!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

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

Labels

level:beginner Beginner level - 20 pts type:bug Bug fix type:refactor Code refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant