Re: [v8-google3] Re: Question - Is it possible as the embedder of V8 engine to call an async function directly and await the result?

49 views
Skip to first unread message

Andreas Haas

unread,
Jan 12, 2021, 8:25:34 AM1/12/21
to Marja Hölttä, v8-users, Maitri Shastri, V8 Google3, Neeraj Kumar

On Tue, Jan 12, 2021 at 2:23 PM Andreas Haas <ah...@google.com> wrote:
Hi All,

We were able to minimize the issue further. The problem is that the result of the script is a promise. Already the script

new Promise((res, rej) => {});

hangs (thanks Camillo). The problem could be a missing MicroTasksScope, but we still have to verify that.

Cheers, Andreas


On Tue, Jan 12, 2021 at 8:25 AM Marja Hölttä <ma...@google.com> wrote:
Hi,

Top-level await only works for modules; assuming your scripts are not modules, so that's not applicable for you.

Didn't ahaas@ implement an API for checking whether there's a pending task, so that you could spin the event loop while there's one?


On Mon, Jan 11, 2021 at 5:30 PM Maitri Shastri <maitri...@google.com> wrote:

On Mon, Jan 11, 2021 at 9:59 PM Maitri Shastri <maitri...@google.com> wrote:
Hi All,
Apps Script (script.google.com) uses Chrome V8 execution engine. Recently we encountered a bug (http://b/176740430) where the user called an async function directly and the script timed out. Is it possible as the embedder to call an async function and await the result?
Executed it in chrome browser - and the linked snippet didnt time out there. +Andreas Haas pointed me to a public documentation.


--


Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.

    

This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.


Ben Noordhuis

unread,
Jan 12, 2021, 9:15:22 AM1/12/21
to v8-users, Marja Hölttä, Maitri Shastri, V8 Google3, Neeraj Kumar
On Tue, Jan 12, 2021 at 2:25 PM 'Andreas Haas' via v8-users
<v8-u...@googlegroups.com> wrote:
>
> +v8-users
>
> On Tue, Jan 12, 2021 at 2:23 PM Andreas Haas <ah...@google.com> wrote:
>>
>> Hi All,
>>
>> We were able to minimize the issue further. The problem is that the result of the script is a promise. Already the script
>>
>> new Promise((res, rej) => {});
>>
>> hangs (thanks Camillo). The problem could be a missing MicroTasksScope, but we still have to verify that.
>>
>> Cheers, Andreas
>>
>>
>> On Tue, Jan 12, 2021 at 8:25 AM Marja Hölttä <ma...@google.com> wrote:
>>>
>>> Hi,
>>>
>>> Top-level await only works for modules; assuming your scripts are not modules, so that's not applicable for you.
>>>
>>> Didn't ahaas@ implement an API for checking whether there's a pending task, so that you could spin the event loop while there's one?
>>>
>>>
>>> On Mon, Jan 11, 2021 at 5:30 PM Maitri Shastri <maitri...@google.com> wrote:
>>>>
>>>> +V8 Google3
>>>>
>>>> On Mon, Jan 11, 2021 at 9:59 PM Maitri Shastri <maitri...@google.com> wrote:
>>>>>
>>>>> Hi All,
>>>>> Apps Script (script.google.com) uses Chrome V8 execution engine. Recently we encountered a bug (http://b/176740430) where the user called an async function directly and the script timed out. Is it possible as the embedder to call an async function and await the result?
>>>>> Executed it in chrome browser - and the linked snippet didnt time out there. +Andreas Haas pointed me to a public documentation.

new Promise((res, rej) => {}) won't ever resolve. It's not that you
can't await it (there are several ways of doing that) but it's never
going to complete.
Reply all
Reply to author
Forward
0 new messages