Vinlic / WebVideoCreator

🌈 A framework for rendering web animations into videos. It's implemented based on Node.js + Puppeteer + Chrome + FFmpeg, utilizing the latest browser APIs.
Apache License 2.0
137 stars 33 forks source link

Unclosed chromium Procceses #24

Open WebsheetPlugin opened 9 months ago

WebsheetPlugin commented 9 months ago

I noticed that using this Framework to create many Videos also creates many permanent chromium processes. Is there some need to close them or is this a bug?

ayuanlmo commented 7 months ago

I also encountered a similar issue, but I solved it by using child processes. The main process starts a synthetic task using child_process. In the child process, I use:

video.once('completed', (): void => {
  process.exit(0);
});

After exit, I checked the processes in the task manager, and it was indeed closed. However, this is clearly achieved by the Windows operating system.

I'm not sure if this is a good solution, but it does solve the problem.

ivangusev commented 5 months ago

There is no need to close chromium processes, because they are reused for subsequent rendering requests. All of them will be closed automatically when your script finishes. But sometimes chrome starts own child processes which are not closing together with main process.