Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
async_hooks: fix id assignment in fast-path promise hook#34548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async_hooks: fix id assignment in fast-path promise hook #34548
Uh oh!
There was an error while loading. Please reload this page.
Conversation
de142ac to 61cf759CompareUh oh!
There was an error while loading. Please reload this page.
61cf759 to c03a3adCompareUh oh!
There was an error while loading. Please reload this page.
c03a3ad to 2823ac3Comparenodejs-github-bot commented Jul 31, 2020
puzpuzpuz commented Jul 31, 2020
@addaleax thanks for the helpful review! |
addaleax commented Jul 31, 2020
Looks like the debug build breaks here with a linking error – you may want to add something like // TODO(addaleax): Remove once we're on C++17.constexprdouble AsyncWrap::kInvalidAsyncId;somewhere (this is a common issue with C++14, you can search the codebase for more instances of the |
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
2823ac3 to f6059e3Comparepuzpuzpuz commented Jul 31, 2020
@addaleax thanks for sharing this workaround. I've added the duplicate |
nodejs-github-bot commented Aug 1, 2020
nodejs-github-bot commented Aug 1, 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 <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
puzpuzpuz commented Aug 3, 2020
Landed in b7a2329 |
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 <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
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 <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
This PR fixes a bug introduced by #34512.
Native side of fast-path promise hook was not calling JS
fastPromiseHookfunction 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 resultexecutionAsyncIdcould return wrong id when called within promise's.then().Refs: #34512
cc @nodejs/async_hooks
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes