Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Allowing to terminate a vm context/script #3690
So I would like to be able to terminate a script running in its vm context. So kill all resources allocated to it, all timers, stuff like that. I do not worry so much about busy loops or something, more that the code in vm would be listening to events and at some point outside code would like to clean it up, terminate it.
But it seems this is not possible. That the only thing is to specify a fixed timeout? But not that it should terminate on demand from outside (or inside even).
The timeout is to kill uninterruptible JS code (think infinite loops) but killing off everything associated with a context (like registered callbacks, timers, etc.) currently isn't possible and I'm not sure it's even possible to get to that level of isolation without completely separating VM contexts. If you need that kind of control, consider using child processes, possibly VM contexts in child processes.