Description
- Version: v16.2.0 (also reproduces on v16.3.0, but not v16.1.0)
- Platform: Darwin [host] 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
- Subsystem: Not sure
What steps will reproduce the bug?
Run the following script with node repro.js
:
// repro.js
'use strict';
const Repl = require('repl');
const { AsyncLocalStorage } = require('async_hooks');
new AsyncLocalStorage().run({}, async () => {
Repl.start();
await new Promise(process.nextTick);
});
The process crashes after the repl prompt >
is printed, and a stacktrace from C-land is produced: see the output below.
How often does it reproduce? Is there a required condition?
Given the info above it consistently reproduces on node v16.2.0 and v16.3.0, but not on any of the previous versions of node v16.
What is the expected behavior?
The repl should appear, and the rest of the callback passed to run()
should execute. The process should not exit until the user exits the repl.
What do you see instead?
This is the output from the reproduction script shown above. The process crashes near-immediately, but you can see that the repl prompt >
is output.
> node[90057]: ../src/api/callback.cc:125:void node::InternalCallbackScope::Close(): Assertion `(env_->execution_async_id()) == (0)' failed.
1: 0x106e127e5 node::Abort() (.cold.1) [/path/to/node]
2: 0x105ac5b39 node::Abort() [/path/to/node]
3: 0x105ac59a1 node::Assert(node::AssertionInfo const&) [/path/to/node]
4: 0x1059f5cdd node::InternalCallbackScope::Close() [/path/to/node]
5: 0x1059f55de node::InternalCallbackScope::~InternalCallbackScope() [/path/to/node]
6: 0x105b331db node::PerIsolatePlatformData::RunForegroundTask(std::__1::unique_ptr<v8::Task, std::__1::default_delete<v8::Task> >) [/path/to/node]
7: 0x105b31ca7 node::PerIsolatePlatformData::FlushForegroundTasksInternal() [/path/to/node]
8: 0x1064bec03 uv__async_io [/path/to/node]
9: 0x1064d287c uv__io_poll [/path/to/node]
10: 0x1064bf171 uv_run [/path/to/node]
11: 0x1059f6ea4 node::SpinEventLoop(node::Environment*) [/path/to/node]
12: 0x105b07414 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/path/to/node]
13: 0x105a9397d node::Start(int, char**) [/path/to/node]
14: 0x7fff793ca3d5 start [/usr/lib/system/libdyld.dylib]
15: 0x2
[1] 90057 abort node repro.js
Additional information
This was originally observed when using hpal-debug's repl, which is run under async local storage. I think that's about it, but happy to provide any more information!