async_hooks: remove promise object from resource by AndreasMadsen · Pull Request #23443 · nodejs/node (original) (raw)

While it doesn't make any difference now. In the future PromiseHooks
could be refactored to provide an asyncId instead of the promise object.
That would make escape analysis on promises possible.

Escape analysis on promises could lead to a more efficient destroy hook,
if provide by PromiseHooks as well. But at the very least would allow
the destroy hook to be emitted earlier. The destroy hook not being
emitted on promises frequent enough is a known and reported issue.
See #14446 and Jeff-Lewis/cls-hooked#11.

While all this is speculation for now, it all depends on the promise
object not being a part of the PromiseWrap resource object.

Ref: #14446
Ref: nodejs/diagnostics#188

Checklist

/cc @nodejs/diagnostics @nodejs/v8