Node doesn't exit after renderMedia()/renderFrames() unless closeBrowser() is called
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- node.js, typescript
Research direction
Start by reading the renderer API entry points for renderMedia(), renderFrames() and openBrowser(), and compare their browser lifecycle with the CLI's finally cleanup. Issue #28 is already open for the documentation change, so check its scope before taking this on. Done means a render-only script exits as expected, or the intended need to call closeBrowser() is clearly documented.
Written by the indexing model from the issue text.
Description
When I use the renderer API from a script, the process keeps running after the render and stitch are finished:
import path from 'node:path';
import { bundle } from '@rendiv/bundler';
import { selectComposition, renderMedia } from '@rendiv/renderer';
const serveUrl = await bundle({ entryPoint: path.resolve('src/index.tsx') });
const composition = await selectComposition(serveUrl, 'MyComp');
await renderMedia({ serveUrl, composition, outputLocation: 'out/out.mp4' });
console.log('done'); // prints, but the process never exits
It's the shared Chromium from openBrowser(). It stays open after the render, and its child processes keep the event loop alive. process.getActiveResourcesInfo() after done shows two ProcessWrap and six PipeWrap handles, and the process was still running 45 s later (master 6d6aca2, Windows 11, Node 24). Adding await closeBrowser() at the end fixes it, and the process exits right away. I first suspected Vite's esbuild from bundle() as well, but it isn't holding anything open.
I see the CLI already calls closeBrowser() in a finally, and I guess the browser is kept open on purpose so later renders are faster. So I think the simplest fix is to mention it in the docs, which don't cover closeBrowser() right now. I opened #28 for that. While I was there I also fixed the usage example: it imports bundle from @rendiv/renderer and passes compositionId, which renderMedia doesn't take.
If you'd rather handle it in code, something like a closeBrowserWhenDone option would work too.
- Dominant language
- TypeScript
- Stars
- 159
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from thecodacus/rendiv
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
thecodacus/rendiv#17 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
thecodacus/rendiv#16 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
thecodacus/rendiv#15 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
thecodacus/rendiv#24 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
thecodacus/rendiv#23 ·
All issues in thecodacus/rendiv
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Open-Earth-Foundation/CityCatalyst#3399 ·
Maintainers usually reply within 2 days
-
userReport
Difficulty 1/5 Under an hour Newbie friendliness 72/100
nkprasad12/morcus-net#631 ·
Maintainers usually reply within 1 day
-
fix(app): fail closed if GetGeneralSetting fails during initializationPossibly taken @kalavt claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
nekko-labs/nekko-agent#1756 ·
Maintainers usually reply within 1 day
-
needs-area-label
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 2 days