Skip to content

inspector: prevent propagation of promise hooks to noPromise hooks#58841

Merged
nodejs-github-bot merged 1 commit intonodejs:mainfrom
islandryu:fix/inspector-async-task
Aug 12, 2025
Merged

inspector: prevent propagation of promise hooks to noPromise hooks#58841
nodejs-github-bot merged 1 commit intonodejs:mainfrom
islandryu:fix/inspector-async-task

Conversation

@islandryu
Copy link
Copy Markdown
Member

@islandryu islandryu commented Jun 26, 2025

This fix is intended to address a crash that occurs when inspecting code using async hooks with a debug build.

It resolves an issue where Promise hook events were incorrectly propagating to noPromiseHook.

reproduction

The issue can be reproduced using the added test case.
Alternatively, you can reproduce it by debugging code that uses async hooks with Chrome Inspector.
Since it's caused by a debug check failure, it only occurs in debug builds.

The error message is as follows:

#
# Fatal error in ../../deps/v8/src/inspector/v8-debugger.cc, line 1289
# Debug check failed: m_currentTasks.back() == task.
#
#
#
#FailureMessage Object: 0x16fdfd758
----- Native stack trace -----

 1: 0x10012d4f0 node::DumpNativeBacktrace(__sFILE*) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
 2: 0x1003c9260 node::NodePlatform::GetStackTracePrinter()::$_0::operator()() const [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
 3: 0x1003c921c node::NodePlatform::GetStackTracePrinter()::$_0::__invoke() [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
 4: 0x102e74918 V8_Fatal(char const*, int, char const*, ...) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
 5: 0x102e74288 v8::base::SetFatalFunction(void (*)(char const*, int, char const*)) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
 6: 0x101543094 v8_inspector::V8Debugger::asyncTaskFinishedForStack(void*) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
 7: 0x100569efc node::inspector::NodeInspectorClient::AsyncTaskFinished(void*) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
 8: 0x100569ec0 node::inspector::Agent::AsyncTaskFinished(void*) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
 9: 0x100597418 void node::inspector::(anonymous namespace)::InvokeAsyncTaskFnWithId<&node::inspector::Agent::AsyncTaskFinished(void*)>(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
10: 0x101f76298 Builtins_CallApiCallbackGeneric [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
11: 0x101f7466c Builtins_InterpreterEntryTrampoline [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
12: 0x101f7466c Builtins_InterpreterEntryTrampoline [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
13: 0x101f7466c Builtins_InterpreterEntryTrampoline [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
14: 0x101fa6398 Builtins_RunMicrotasks [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
15: 0x101f71590 Builtins_JSRunMicrotasksEntry [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
16: 0x100a533b4 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
17: 0x100a54bb4 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
18: 0x100a55244 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
19: 0x100aaca68 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
20: 0x100aac718 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
21: 0x10004d124 node::InternalCallbackScope::Close() [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
22: 0x10004cf00 node::InternalCallbackScope::~InternalCallbackScope() [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
23: 0x10004c89c node::InternalCallbackScope::~InternalCallbackScope() [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
24: 0x1001f7d90 node::StartExecution(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
25: 0x10005da38 node::LoadEnvironment(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>, std::__1::function<void (node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Value>)>) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
26: 0x1003342d8 node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
27: 0x100333f64 node::NodeMainInstance::Run() [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
28: 0x1001fa9a4 node::StartInternal(int, char**) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
29: 0x1001fa5c0 node::Start(int, char**) [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
30: 0x10258fb64 main [/Users/shimaryuuhei/workspace/islandryu2/node/out/Debug/node]
31: 0x1818a8274 start [/usr/lib/dyld]

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async_hooks Issues and PRs related to the async hooks subsystem. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. inspector Issues and PRs related to the V8 inspector protocol needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants