-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
APM tracing with async_hooks broken on Node 10. #20516
Comments
Pretty sure it is because of #20274 |
#20467 does not fix this. See my comment in the thread. |
The problem is that after the await
```js
'use strict';
const asyncHooks = require('async_hooks');
const sleep = require('util').promisify(setTimeout);
async function main() { main().catch(console.error);
|
I pointed out this exact issue already. #20274 (comment) |
#20274 (comment) from @bmeurer states that #20467 fixes it. @BridgeAR pointed out that it is a different bug in #20467 (comment). I'm leaning towards this being a different bug. It would be better if you could verify that as well @Qard. |
It is a separate issue. The fix from #20274 fix the async id being 0 after an await. The choregraphy of async events seems to be slightly different in master, that causes the break even after the fix from #20274 is applied.
Adding a log to the init hook:
IOW, the resource 14 was created before the execution of In Node 9 and older, the 'async resume' resource doesn't get initialized as early, so things end up working. I think we need a bisect to figure out why this happened. |
Looking into this and will try to do a new fix soon, which will probably include a proper fix for #20274. |
@MayaLekova let me know when you have a patch to test. I can get it tested quickly. |
@mcollina Please take a look at this commit - it basically reverts @bmeurer 's optimizations related to the async hooks. Some background: we tried implementing a fix on top of the current V8 head without success. So the current action plan is:
Thanks for the cooperation! |
@MayaLekova that commit does not land cleanly on recent master, can you rebase? |
@mcollina Does it merge cleanly now? |
@MayaLekova https://github.com/MayaLekova/node/tree/fix-20516 is still diverging a lot from Node.js master. I suspect it's done on top of a newer version of V8. The PR fixes the bug, good job! |
Until nodejs/node#20516 have been resolved, we have disabled the hapi tests to make sure we still test as much as possible on Node.js 10
Until nodejs/node#20516 have been resolved, we have disabled the hapi tests to make sure we still test as much as possible on Node.js 10
Add a basic test ensuring parity between before-after and init-promiseResolve hooks when using async/await. Refs: nodejs#20516
Add ability to initHooks and to checkInvocations utilities to transmit promiseResolve hook as well. Refs: nodejs#20516
Reword async/await test to make use of the initHooks utility and an attempt to clarify the test's logic. Refs: nodejs#20516
Add a basic test ensuring parity between before-after and init-promiseResolve hooks when using async/await. Add ability to initHooks and to checkInvocations utilities to transmit promiseResolve hook as well. See: #20516 PR-URL: #20626 Refs: #20516 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
Add a basic test ensuring parity between before-after and init-promiseResolve hooks when using async/await. Add ability to initHooks and to checkInvocations utilities to transmit promiseResolve hook as well. See: #20516 PR-URL: #20626 Refs: #20516 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
Add a test that checks the structure of the async resource tree when async generator is being looped with "for async...of". Refs: nodejs#20516
Add a basic test ensuring parity between before-after and init-promiseResolve hooks when using async/await. Add ability to initHooks and to checkInvocations utilities to transmit promiseResolve hook as well. See: nodejs#20516 PR-URL: nodejs#20626 Refs: nodejs#20516 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
LGTM on including the backport from @mcollina |
@mcollina Currently not working on the backport, will be able to look at this again tomorrow. |
Awesome :). |
Original commit message: Revert promises optimizations due to regressions in async hooks Revert "[async-await] Eliminate throwaway promise in async functions." This reverts commit a840f1f8f7e6c9ab32dec456a954612619855093. Revert "[async-generators] Also avoid throwaway promise here." This reverts commit feb545ceba5cb477ba883b46b60142f441ad5a3d. Revert "[async-await] Turn await closures into intrinsics." This reverts commit d97bb317386506a6798386b74647cbe0502fce35. Revert "[async-generators] Add fast-path for primitives in AsyncGeneratorYield." This reverts commit e57b500eb26dc595609613963468910eb4bcae2e. Revert "[async-generators] Add fast-path to skip "then" lookup in AsyncGeneratorResolve." This reverts commit c15802e11e30976528d1b711a9b9e6ff6b490117. Revert "[promises] Correctly run before/after hooks for await." This reverts commit ca7639239fc13e992e857710cbf7dbaac87163bf. Bug: v8:7253, v8:7745 Change-Id: I25ad0d2df3cfbc84dbb431aa25b268bce8a39e89 Reviewed-on: https://chromium-review.googlesource.com/1049975 Commit-Queue: Maya Lekova <mslekova@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{nodejs#53139} Refs: v8/v8@91ddb65 Fixes: nodejs#20516 Co-authored-by: Matteo Collina <matteo.collina@gmail.com>
Original commit message: Revert promises optimizations due to regressions in async hooks Revert "[async-await] Eliminate throwaway promise in async functions." This reverts commit a840f1f8f7e6c9ab32dec456a954612619855093. Revert "[async-generators] Also avoid throwaway promise here." This reverts commit feb545ceba5cb477ba883b46b60142f441ad5a3d. Revert "[async-await] Turn await closures into intrinsics." This reverts commit d97bb317386506a6798386b74647cbe0502fce35. Revert "[async-generators] Add fast-path for primitives in AsyncGeneratorYield." This reverts commit e57b500eb26dc595609613963468910eb4bcae2e. Revert "[async-generators] Add fast-path to skip "then" lookup in AsyncGeneratorResolve." This reverts commit c15802e11e30976528d1b711a9b9e6ff6b490117. Revert "[promises] Correctly run before/after hooks for await." This reverts commit ca7639239fc13e992e857710cbf7dbaac87163bf. Bug: v8:7253, v8:7745 Change-Id: I25ad0d2df3cfbc84dbb431aa25b268bce8a39e89 Reviewed-on: https://chromium-review.googlesource.com/1049975 Commit-Queue: Maya Lekova <mslekova@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#53139} Refs: v8/v8@91ddb65 Fixes: #20516 Co-authored-by: Matteo Collina <matteo.collina@gmail.com> PR-URL: #19989 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matheus Marchini <matheus@sthima.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Myles Borins <myles.borins@gmail.com>
The bug in V8 that meant we couldn't instrument Node 10 was fixed and Node 10.4.0 shipped with a newer version of V8. This is the original bug report in Node: nodejs/node#20516 This is the PR that fixed it in Node: nodejs/node#19989
The bug in V8 that meant we couldn't instrument Node 10 was fixed and Node 10.4.0 shipped with a newer version of V8. This is the original bug report in Node: nodejs/node#20516 This is the PR that fixed it in Node: nodejs/node#19989 Closes elastic#448
The bug in V8 that meant we couldn't instrument Node 10 was fixed and Node 10.4.0 shipped with a newer version of V8. This is the original bug report in Node: nodejs/node#20516 This is the PR that fixed it in Node: nodejs/node#19989 Closes #448
The following represent a pattern very commonly used by APMs:
Correct behavior (node 8.11.1):
master:
The text was updated successfully, but these errors were encountered: