In certain circumstances, e.g. extension that does while (true) loop, the extension host process will not terminate unless killed via task manager.
Implement a watch-dog mechanism that can kill runaway extension host processes.
NB: This was not an issue on Windows until we made the process be forked with the detached option to allow 5s for the extensions to gracefully shut down.
An idea would be to:
Cool idea. Will avoid having yet another process running.
Can this also detect how much % CPU the process is using, give a notification which process is long-running, and give the user the option of restarting/killing it? That way you would also expose potentially problematic extensions?
Well, we'd want the JS stack trace, not the C++ one (otherwise we'd just see v8 being in the stack).
That appears to be difficult from the discussion in https://github.com/nodejs/node-v0.x-archive/issues/25263
Due to instability (increased number of crashes), the watch-dog code is now disabled -- starting with today's Insiders Build (2017-08-23). We have also upgraded to Electron 1.7.4 and 1.7.5 and we should be cautious of introducing too much instability at once (see also #33016).
Re-iterating thoughts expressed by @sjelfull . I've been suffering from high cpu on an rMBP and can't figure out which extension is causing this.
This is overly tough to diagnose: whenever I launch developer tools, it seems the problem goes away...literally, I launch the tools and the fans start to calm down, eventually turning off completely. Makes no sense. Because I have no idea what's causing it, I can't try to repro. The problem just seems to randomly appear.
Having some sort of automated way to identify problematic extensions would be extremely helpful, perhaps more so than just quietly killing them.
This has been implemented now on master.
Adding verification needed, but this probably needs some test plan input and testing across OS (cc @mjbvz).
Most helpful comment
Can this also detect how much % CPU the process is using, give a notification which process is long-running, and give the user the option of restarting/killing it? That way you would also expose potentially problematic extensions?