Skip to content

v8 Panics and Excludes plugin from instrumentation. #6153

@LRagji

Description

@LRagji

What happened?

Steps to Reproduce

  1. Clone https://github.com/LRagji/OTEL-Adventure
  2. Just run service-a with debugger attached.
  3. Put a breakpoint on service-a/node_modules/@opentelemetry/instrumentation/build/src/platform/node/instrumentation.js line 220, inside enable function
  4. Move your debugger line by line untill you hit for (const module of this._modules) { line

Expected Result

It should not crash on debugging, and also should load the express plugin.

Actual Result

  1. V8 panics and process crashes when in debug mode.
  2. Run without debugger process continues but express plugin is never loaded.

Additional Details

Machine: M4 Mac
Node runtime: 24.5.0
Fatal Error log:

#
# Fatal error in , line 0
# Check failed: needs_context && current_scope_ == closure_scope_ && current_scope_->is_function_scope() && !function_.is_null() implies function_->context() != *context_.
#
#
#
#FailureMessage Object: 0x16b767d68
----- Native stack trace -----

Chat GPTs take on the stack printed by v8: Bug in node

OpenTelemetry Setup Code

package.json

Relevant log output

node --import ./instrumentation.ts --experimental-strip-types index.ts
Debugger attached.
@opentelemetry/api: Registered a global for diag v1.9.0.
Disabling instrumentation for @opentelemetry/instrumentation-amqplib
Disabling instrumentation for @opentelemetry/instrumentation-aws-lambda
Disabling instrumentation for @opentelemetry/instrumentation-aws-sdk
Disabling instrumentation for @opentelemetry/instrumentation-bunyan
Disabling instrumentation for @opentelemetry/instrumentation-cassandra-driver
Disabling instrumentation for @opentelemetry/instrumentation-connect
Disabling instrumentation for @opentelemetry/instrumentation-cucumber
Disabling instrumentation for @opentelemetry/instrumentation-dataloader
Disabling instrumentation for @opentelemetry/instrumentation-dns
Loading instrumentation for @opentelemetry/instrumentation-express


#
# Fatal error in , line 0
# Check failed: needs_context && current_scope_ == closure_scope_ && current_scope_->is_function_scope() && !function_.is_null() implies function_->context() != *context_.
#
#
#
#FailureMessage Object: 0x16b767d68
----- Native stack trace -----

 1: 0x10482f17c node::NodePlatform::GetStackTracePrinter()::$_0::__invoke() [[redacted_sensitive_user_system path]]
 2: 0x1060581cc V8_Fatal(char const*, ...) [[redacted_sensitive_user_system path]]
 3: 0x104abe430 v8::internal::ScopeIterator::VisitLocalScope(std::__1::function<bool (v8::internal::Handle<v8::internal::String>, v8::internal::Handle<v8::internal::Object>, v8::internal::ScopeIterator::ScopeType)> const&, v8::internal::ScopeIterator::Mode, v8::internal::ScopeIterator::ScopeType) const [[redacted_sensitive_user_system path]]
 4: 0x104abd484 v8::internal::ScopeIterator::ScopeObject(v8::internal::ScopeIterator::Mode) [[redacted_sensitive_user_system path]]
 5: 0x1050f7fc4 v8_inspector::V8DebuggerAgentImpl::currentCallFrames(std::__1::unique_ptr<std::__1::vector<std::__1::unique_ptr<v8_inspector::protocol::Debugger::CallFrame, std::__1::default_delete<v8_inspector::protocol::Debugger::CallFrame>>, std::__1::allocator<std::__1::unique_ptr<v8_inspector::protocol::Debugger::CallFrame, std::__1::default_delete<v8_inspector::protocol::Debugger::CallFrame>>>>, std::__1::default_delete<std::__1::vector<std::__1::unique_ptr<v8_inspector::protocol::Debugger::CallFrame, std::__1::default_delete<v8_inspector::protocol::Debugger::CallFrame>>, std::__1::allocator<std::__1::unique_ptr<v8_inspector::protocol::Debugger::CallFrame, std::__1::default_delete<v8_inspector::protocol::Debugger::CallFrame>>>>>>*) [[redacted_sensitive_user_system path]]
 6: 0x1050ee390 v8_inspector::V8DebuggerAgentImpl::didPause(int, v8::Local<v8::Value>, std::__1::vector<int, std::__1::allocator<int>> const&, v8::debug::ExceptionType, bool, v8::base::EnumSet<v8::debug::BreakReason, int>) [[redacted_sensitive_user_system path]]
 7: 0x105110b60 v8_inspector::V8InspectorImpl::forEachSession(int, std::__1::function<void (v8_inspector::V8InspectorSessionImpl*)> const&) [[redacted_sensitive_user_system path]]
 8: 0x105101c38 v8_inspector::V8Debugger::handleProgramBreak(v8::Local<v8::Context>, v8::Local<v8::Value>, std::__1::vector<int, std::__1::allocator<int>> const&, v8::base::EnumSet<v8::debug::BreakReason, int>, v8::debug::ExceptionType, bool) [[redacted_sensitive_user_system path]]
 9: 0x104ac4bb4 v8::internal::Debug::OnDebugBreak(v8::internal::DirectHandle<v8::internal::FixedArray>, v8::internal::StepAction, v8::base::EnumSet<v8::debug::BreakReason, int>) [[redacted_sensitive_user_system path]]
10: 0x104ac4130 v8::internal::Debug::Break(v8::internal::JavaScriptFrame*, v8::internal::DirectHandle<v8::internal::JSFunction>) [[redacted_sensitive_user_system path]]
11: 0x1050464a4 v8::internal::Runtime_DebugBreakOnBytecode(int, unsigned long*, v8::internal::Isolate*) [[redacted_sensitive_user_system path]]
12: 0x1056a21f4 Builtins_CEntry_Return2_ArgvOnStack_NoBuiltinExit [[redacted_sensitive_user_system path]]
13: 0x10577f708 Builtins_DebugBreak3Handler [[redacted_sensitive_user_system path]]
14: 0x105604bec Builtins_InterpreterEntryTrampoline [[redacted_sensitive_user_system path]]
15: 0x105604bec Builtins_InterpreterEntryTrampoline [[redacted_sensitive_user_system path]]
16: 0x105605400 Builtins_InterpreterPushArgsThenFastConstructFunction [[redacted_sensitive_user_system path]]
17: 0x105794d28 Builtins_ConstructHandler [[redacted_sensitive_user_system path]]
18: 0x105604bec Builtins_InterpreterEntryTrampoline [[redacted_sensitive_user_system path]]
19: 0x105605400 Builtins_InterpreterPushArgsThenFastConstructFunction [[redacted_sensitive_user_system path]]
20: 0x105794d28 Builtins_ConstructHandler [[redacted_sensitive_user_system path]]
21: 0x105604bec Builtins_InterpreterEntryTrampoline [[redacted_sensitive_user_system path]]
22: 0x105604bec Builtins_InterpreterEntryTrampoline [[redacted_sensitive_user_system path]]
23: 0x105645ce8 Builtins_GeneratorPrototypeNext [[redacted_sensitive_user_system path]]
24: 0x1056028cc Builtins_JSEntryTrampoline [[redacted_sensitive_user_system path]]
25: 0x105602570 Builtins_JSEntry [[redacted_sensitive_user_system path]]
26: 0x104b2dd48 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [[redacted_sensitive_user_system path]]
27: 0x104b2e574 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [[redacted_sensitive_user_system path]]
28: 0x104b2e640 v8::internal::Execution::TryCall(v8::internal::Isolate*, v8::internal::DirectHandle<v8::internal::Object>, v8::internal::DirectHandle<v8::internal::Object>, v8::base::Vector<v8::internal::DirectHandle<v8::internal::Object> const>, v8::internal::Execution::MessageHandling, v8::internal::MaybeDirectHandle<v8::internal::Object>*) [[redacted_sensitive_user_system path]]
29: 0x104f4133c v8::internal::SourceTextModule::ExecuteModule(v8::internal::Isolate*, v8::internal::DirectHandle<v8::internal::SourceTextModule>, v8::internal::MaybeDirectHandle<v8::internal::Object>*) [[redacted_sensitive_user_system path]]
30: 0x104f40c68 v8::internal::SourceTextModule::InnerModuleEvaluation(v8::internal::Isolate*, v8::internal::Handle<v8::internal::SourceTextModule>, v8::internal::ZoneForwardList<v8::internal::Handle<v8::internal::SourceTextModule>>*, unsigned int*) [[redacted_sensitive_user_system path]]
31: 0x104f4066c v8::internal::SourceTextModule::Evaluate(v8::internal::Isolate*, v8::internal::Handle<v8::internal::SourceTextModule>) [[redacted_sensitive_user_system path]]
32: 0x104ef8628 v8::internal::Module::Evaluate(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Module>) [[redacted_sensitive_user_system path]]
33: 0x1049930a8 v8::Module::Evaluate(v8::Local<v8::Context>) [[redacted_sensitive_user_system path]]
34: 0x104751fc4 node::loader::ModuleWrap::Evaluate(v8::FunctionCallbackInfo<v8::Value> const&) [[redacted_sensitive_user_system path]]
35: 0x105606818 Builtins_CallApiCallbackGeneric [[redacted_sensitive_user_system path]]
36: 0x105604bec Builtins_InterpreterEntryTrampoline [[redacted_sensitive_user_system path]]
37: 0x105643648 Builtins_AsyncFunctionAwaitResolveClosure [[redacted_sensitive_user_system path]]
38: 0x1057185f8 Builtins_PromiseFulfillReactionJob [[redacted_sensitive_user_system path]]
39: 0x105632a50 Builtins_RunMicrotasks [[redacted_sensitive_user_system path]]
40: 0x1056027b0 Builtins_JSRunMicrotasksEntry [[redacted_sensitive_user_system path]]
41: 0x104b2dd00 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [[redacted_sensitive_user_system path]]
42: 0x104b2e574 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [[redacted_sensitive_user_system path]]
43: 0x104b2e6b0 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*) [[redacted_sensitive_user_system path]]
44: 0x104b5d5b4 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [[redacted_sensitive_user_system path]]
45: 0x104b5df14 v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [[redacted_sensitive_user_system path]]
46: 0x105606818 Builtins_CallApiCallbackGeneric [[redacted_sensitive_user_system path]]
47: 0x105604bec Builtins_InterpreterEntryTrampoline [[redacted_sensitive_user_system path]]
48: 0x1056028cc Builtins_JSEntryTrampoline [[redacted_sensitive_user_system path]]
49: 0x105602570 Builtins_JSEntry [[redacted_sensitive_user_system path]]
50: 0x104b2dd48 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [[redacted_sensitive_user_system path]]
51: 0x104b2d6ac v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::DirectHandle<v8::internal::Object>, v8::internal::DirectHandle<v8::internal::Object>, v8::base::Vector<v8::internal::DirectHandle<v8::internal::Object> const>) [[redacted_sensitive_user_system path]]
52: 0x1049a3574 v8::Function::Call(v8::Isolate*, v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [[redacted_sensitive_user_system path]]
53: 0x104699024 node::InternalCallbackScope::Close() [[redacted_sensitive_user_system path]]
54: 0x104698a18 node::InternalCallbackScope::~InternalCallbackScope() [[redacted_sensitive_user_system path]]
55: 0x104757dd4 node::StartExecution(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>) [[redacted_sensitive_user_system path]]
56: 0x10469daa0 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>)>) [[redacted_sensitive_user_system path]]
57: 0x1047f5010 node::NodeMainInstance::Run() [[redacted_sensitive_user_system path]]
58: 0x10475b628 node::Start(int, char**) [[redacted_sensitive_user_system path]]
59: 0x190cdab98 start [/usr/lib/dyld]
zsh: trace trap  node --import ./instrumentation.ts --experimental-strip-types index.ts

Operating System and Version

Machine: M4 Mac
Node runtime: 24.5.0

Runtime and Version

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriage

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions