On Tue, Jun 27, 2023 at 12:57 PM Meir Shpilraien <m...@redis.com> wrote:
>
> Hey
>
> I notice that when I terminate an async function using TerminateExecution the 
> promise that was suppose to be resolved/rejected as a result of this async 
> function termination are not resolved nor rejected. To demonstrate, look at 
> the following example:
>
> ```js
> async function foo(){
>     await test();
>     throw "foo";
> }
> ```
>
> Calling `foo()` will return a promise that will be rejected after the first 
> await returns because we raise an error. But if I change the code to be the 
> following:
>
> ```js
> async function foo(){
>     await test();
>     while (true);
> }
> ```
>
>  and assuming the embedder will terminate the execution on the `while (true)` 
> after some timeout (using TerminateExecution), the promise that was returned 
> by calling `foo()` will never be resolved nor rejected.
>
> Am I getting it right or am I missing something? Assuming I am right, any 
> suggestions how to solve it?

Your analysis sounds about right.

I don't think there's a workaround. Termination tears down everything,
including the handler code for moving a promise to fulfilled or
rejected state. It's like sending a SIGKILL.

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAHQurc9nk%3DEMJbQ83vJ6QON3XpN2yR-nXEnonR5daiA2iR2n%2Bw%40mail.gmail.com.

Reply via email to