Closed
Description
Version
v18.12.1
Platform
Linux machine 5.15.0-73-generic #80-Ubuntu SMP Mon May 15 15:18:26 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
const { AsyncLocalStorage } = require('async_hooks');
const assert = require('assert');
const als = new AsyncLocalStorage();
assert(als.getStore() === undefined);
als.enterWith({ foo: 'bar' });
assert(als.getStore()?.foo === 'bar');
als.disable();
assert(als.getStore() === undefined);
als.run({ foo: 'zoo' }, () => {
assert(als.getStore()?.foo === 'zoo');
});
assert(als.getStore() === undefined);
How often does it reproduce? Is there a required condition?
reproduces every time
What is the expected behavior? Why is that the expected behavior?
According to the docs
When calling asyncLocalStorage.disable(), all current contexts linked to the instance will be exited.
I would expect that contexts will be exited
What do you see instead?
if you keep using the storage after disable, the context is restored
Additional information
No response