-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
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.
Description
Version
v16.13.0
Platform
Microsoft Windows NT 10.0.19043.0 x64
Subsystem
tcp/tls/async_hooks
What steps will reproduce the bug?
const { AsyncLocalStorage } = require('async_hooks');
const net = require('net');
const asyncLocalStorage = new AsyncLocalStorage();
asyncLocalStorage.run({val: 'abcd'}, () => {
const socket = new net.Socket();
socket.on('data', () => {
// This is 'abcd' with Node 16.6.x, and undefined with Node >=16.7.0
console.log(asyncLocalStorage.getStore()?.val);
});
socket.connect(80, 'google.com', function() {
socket.write('GET /\n');
});
});TLS socket is also broken:
const { AsyncLocalStorage } = require('async_hooks');
const tls = require('tls');
const asyncLocalStorage = new AsyncLocalStorage();
asyncLocalStorage.run({val: 'abcd'}, () => {
const socket = tls.connect({ host: 'google.com', port: 443 });
socket.on('data', () => {
// This is 'abcd' with Node 16.6.x, and undefined with Node >=16.7.0
console.log(asyncLocalStorage.getStore()?.val);
socket.end();
});
socket.on('error', console.error);
socket.write('GET /\n');
});How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
It should write abcd.
What do you see instead?
undefined
Additional information
No response
Reactions are currently unavailable
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.