Hello Robin,
Thank you for your reply!
Let me give you a more detailed explanation: the untrusted code snippet I run is always inside of an async function, so what I do is running multiples async functions concurrently inside of the same v8::Isolate (every time this async code execution is triggered I start a new async function execution). I thought that calling v8::V8::TerminateExecution would reject all my async functions, even the ones that didn't cause the system to block. In my application, it'd be a problem so I've been trying to find a way of rejecting only the async function that caused the blocking.
All the async functions are currently executed inside of the same v8::Context, do you think that running them in separate Contexts could help me?
I think that Cloudflare has a CPU time monitoring system that allows them to stop a function execution every time it exceeds 10ms (free tier) or 50ms (paid plans) without disturbing other functions that are executed at the same time. I've been wondering how they do that as they seem to execute multiple requests inside the same namespace (as JS global variables persist between different function calls sometimes).
About the security issues, I guess you are right, it is needed to improve the system security through some changes. Please, feel free to share your thoughts and experiences about that too.
Cheers