Closed asafyish closed 8 years ago
That sounds very strange. Is your application exited gracefully or crashing?
We are using pm2 (https://github.com/Unitech/pm2) and doing pm2 restart. I am not exactly sure how it kill the process.
It looks like pm2 is sending a SIGINT to the process. So you might want to add the screenshot.close()
call like this:
process.on('SIGINT', function() {
screenshot.close();
});
Tried that... no luck. we still have hundreds of process. BTW, we are using scale to 20. Is that related ?
Scale 20 should just scale the amount to 20 processes (so approx. 20 electron + 20 electron helpers) But there could be more than 1 helper per site.
Maybe using something like https://npmjs.org/package/child-killer when spawning the process could help ?
This sounds really strange. Is the callback called by pm2? child-killer
is polling every 100ms for each process, I would rather not do that. Which OS are you using?
We are using Ubuntu 15.04. What solved the problem is listening fro SIGTERM:
process.on('SIGTERM', function () {
screenshot.close();
setTimeout(function() {
process.exit(0);
}, 1000)
});
Glad you found a solution.
Hi,
After using and restarting many times, I see that we have hundreds of electron process, maybe it will help to use something like https://www.npmjs.com/package/child-killer to ensure process are dead when the parent process dies.