Bug 201005 - [JSC] Prune about-to-be-notified rejected promises list at GC flip
Summary: [JSC] Prune about-to-be-notified rejected promises list at GC flip
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-21 16:09 PDT by Ross Kirsling
Modified: 2019-08-22 15:15 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Kirsling 2019-08-21 16:09:20 PDT
From bug 197172 comment 36:

> If you have a loop with:
> 
> let p = new Promise((resolve, reject) => {
>     ...
>     reject(p)
> });
>
> p will be kept alive until the the microtasks are drained. Which means programs will OOM if they never drain all their microtasks...
>
> I think, at least, you'll need to clear handled promises at the GC flip. See where we call finalizeUnconditionalFinalizers.

Given the WHATWG spec*, I don't believe this is something we can address for the normal, web-hosted case (i.e. the "unhandledrejection" event), but it would be a possible improvement for rejection tracking in a standalone JSContext (which has no spec).

[*] https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections