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 On Monday, February 8, 2021 at 8:35:39 PM UTC-3 Robin Röper wrote: > Hey there, > > I think you may want to give v8::V8::TerminateExecution() a shot. It > throws an uncatchable exception in your JavaScript code. > > I think Cloudflare workers terminated the execution after 30 seconds. > However, I'm not sure if all Promises run in the same execution context in > your Isolate. > > Talking about embedding V8 and running untrusted code, take a look at the > security risks, as V8 does not provide perfect sandboxing / security > capabilities in an embedded environment (Feel free to correct me if I'm > wrong here) > https://developers.cloudflare.com/workers/learning/security-model > > Cheers! > > On Mon 8. Feb 2021 at 23:34, bambam <ehtre...@gmail.com> wrote: > >> Hello guys... I'm embedding the V8 into my own application to run some >> untrusted code concurrently. Every untrusted code is executed inside a >> promise and when any of these codes blocks the system (by doing a >> while(true){} for example) I need to stop it. So, I've been trying to find >> a way of canceling JS promises but I haven't found anything useful. Does >> anyone here know where I could find some related information? >> >> -- >> -- >> v8-users mailing list >> v8-u...@googlegroups.com >> http://groups.google.com/group/v8-users >> --- >> You received this message because you are subscribed to the Google Groups >> "v8-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to v8-users+u...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/v8-users/fb3a5a6f-3b49-4516-a037-4aa19a2bceb2n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/v8-users/fb3a5a6f-3b49-4516-a037-4aa19a2bceb2n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > > *Robin Röper* > Predigerberg 16 > 86150 Augsburg > Tel.: 0176 21400280 > Tel. (work): 0821 79500234 > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/40fa0cea-91f8-444d-a463-1bba1a0ba087n%40googlegroups.com.