-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
async_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.promisesIssues and PRs related to ECMAScript promises.Issues and PRs related to ECMAScript promises.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
Description
- Version: v10.0.0
- Platform: Linux, Windows 10 WSL
Running the following code
const async_hooks = require("async_hooks");
const fs = require("fs");
async_hooks
.createHook({
init: (asyncId, type, triggerAsyncId, resource) => {
fs.writeSync(1, `${triggerAsyncId} => ${asyncId}\n`);
}
})
.enable();
async function main() {
console.log("hello");
await null;
console.log("hello");
}
main();on Node 9 gives the output
1 => 6
hello
1 => 7
6 => 8
8 => 9
hello
9 => 10
while on Node 10 it gives
1 => 6
hello
1 => 7
1 => 8
hello
1 => 9
That is, on Node 10, the triggerAsyncId is always 1, and I am unable to track which contexts follow from which other contexts.
Is one of these unexpected behavior? If the change is a known (undocumented?) new behavior, is there any way with Node 10 to achieve what I was doing under previous versions?
bricss, mcasimir, felipeplets, juancampa, sonicoder86 and 3 more
Metadata
Metadata
Assignees
Labels
async_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.promisesIssues and PRs related to ECMAScript promises.Issues and PRs related to ECMAScript promises.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.