async_hooks: fix id assignment in fast-path promise hook by puzpuzpuz · Pull Request #34548 · nodejs/node

@nodejs-github-bot added the c++

Issues and PRs that require attention from people who are familiar with C++.

label

Jul 29, 2020

addaleax

addaleax

addaleax

benjamingr

@puzpuzpuz

Native side of fast-path promise hook was not calling JS fastPromiseHook
function when there were no async ids previously assigned to the promise.
Because of that already created promises could not get id assigned in
situations when an async hook without a before listener function is enabled
after their creation. As the result executionAsyncId could return wrong id
when called within promise's .then().

Refs: nodejs#34512

This was referenced

Aug 1, 2020

@puzpuzpuz puzpuzpuz added the author ready

PRs that have at least one approval, no pending requests for changes, and a CI started.

label

Aug 1, 2020

This was referenced

Aug 2, 2020

puzpuzpuz added a commit that referenced this pull request

Aug 3, 2020
Native side of fast-path promise hook was not calling JS
fastPromiseHook function when there were no async ids
previously assigned to the promise. Because of that already
created promises could not get id assigned in situations
when an async hook without a before listener function is
enabled after their creation. As the result executionAsyncId
could return wrong id when called within promise's .then().

Refs: #34512

PR-URL: #34548
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>

@puzpuzpuz puzpuzpuz deleted the defect/fast-promise-hook-does-not-assign-ids branch

August 3, 2020 07:37

This was referenced

Aug 4, 2020

codebytere pushed a commit that referenced this pull request

Aug 6, 2020
Native side of fast-path promise hook was not calling JS
fastPromiseHook function when there were no async ids
previously assigned to the promise. Because of that already
created promises could not get id assigned in situations
when an async hook without a before listener function is
enabled after their creation. As the result executionAsyncId
could return wrong id when called within promise's .then().

Refs: #34512

PR-URL: #34548
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>

This was referenced

Aug 7, 2020

codebytere pushed a commit that referenced this pull request

Aug 11, 2020
Native side of fast-path promise hook was not calling JS
fastPromiseHook function when there were no async ids
previously assigned to the promise. Because of that already
created promises could not get id assigned in situations
when an async hook without a before listener function is
enabled after their creation. As the result executionAsyncId
could return wrong id when called within promise's .then().

Refs: #34512

PR-URL: #34548
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>