Skip to content

NodeJS segfaults when trying to debug this code #60580

@sadan4

Description

@sadan4

Version

v24.10.0

Platform

Linux nix-desktop-evo4b5 6.17.5 #1-NixOS SMP PREEMPT_DYNAMIC Thu Oct 23 14:24:41 UTC 2025 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

function crash() {
    const thing = [];
    const otherThing = [];
    // set your breakpoint on line 5, the line starting with for (...), and attempt to step into the loop
    for (const item in thing) {
        otherThing.map(() => item);
    }
}

crash()

How often does it reproduce? Is there a required condition?

i can reproduce it 100% of the time

What is the expected behavior? Why is that the expected behavior?

nodejs does not segfault while debugging

What do you see instead?

nodejs segfaults while debugging

Additional information

this does not happen when i debug the script while its running in the browser (Chromium 141.0.7390.122)

backtrace from coredump

#0  0x0000560f095a63f4 in v8::internal::ScopeIterator::UnwrapEvaluationContext() ()
#1  0x0000560f095a4d24 in v8::internal::DebugScopeIterator::Advance() ()
#2  0x0000560f09cdfa15 in v8_inspector::V8DebuggerAgentImpl::currentCallFrames(std::unique_ptr<std::vector<std::unique_ptr<v8_inspector::protocol::Debugger::CallFrame, std::default_delete<v8_inspector::protocol::Debugger::CallFrame> >, std::allocator<std::unique_ptr<v8_inspector::protocol::Debugger::CallFrame, std::default_delete<v8_inspector::protocol::Debugger::CallFrame> > > >, std::default_delete<std::vector<std::unique_ptr<v8_inspector::protocol::Debugger::CallFrame, std::default_delete<v8_inspector::protocol::Debugger::CallFrame> >, std::allocator<std::unique_ptr<v8_inspector::protocol::Debugger::CallFrame, std::default_delete<v8_inspector::protocol::Debugger::CallFrame> > > > > >*) ()
#3  0x0000560f09ce5fa5 in v8_inspector::V8DebuggerAgentImpl::didPause(int, v8::Local<v8::Value>, std::vector<int, std::allocator<int> > const&, v8::debug::ExceptionType, bool, v8::base::EnumSet<v8::debug::BreakReason, int>) ()
#4  0x0000560f09ced8b8 in std::_Function_handler<void (v8_inspector::V8InspectorSessionImpl*), v8_inspector::V8Debugger::handleProgramBreak(v8::Local<v8::Context>, v8::Local<v8::Value>, std::vector<int, std::allocator<int> > const&, v8::base::EnumSet<v8::debug::BreakReason, int>, v8::debug::ExceptionType, bool)::{lambda(v8_inspector::V8InspectorSessionImpl*)#2}>::_M_invoke(std::_Any_data const&, v8_inspector::V8InspectorSessionImpl*&&) ()
#5  0x0000560f09d022c3 in v8_inspector::V8InspectorImpl::forEachSession(int, std::function<void (v8_inspector::V8InspectorSessionImpl*)> const&) ()
#6  0x0000560f09cf096e in v8_inspector::V8Debugger::handleProgramBreak(v8::Local<v8::Context>, v8::Local<v8::Value>, std::vector<int, std::allocator<int> > const&, v8::base::EnumSet<v8::debug::BreakReason, int>, v8::debug::ExceptionType, bool) ()
#7  0x0000560f09cf0afa in v8_inspector::V8Debugger::BreakProgramRequested(v8::Local<v8::Context>, std::vector<int, std::allocator<int> > const&, v8::base::EnumSet<v8::debug::BreakReason, int>) ()
#8  0x0000560f095baab2 in v8::internal::Debug::OnDebugBreak(v8::internal::DirectHandle<v8::internal::FixedArray>, v8::internal::StepAction, v8::base::EnumSet<v8::debug::BreakReason, int>) ()
#9  0x0000560f095baf2c in v8::internal::Debug::Break(v8::internal::JavaScriptFrame*, v8::internal::DirectHandle<v8::internal::JSFunction>) ()
#10 0x0000560f09bf6203 in v8::internal::Runtime_DebugBreakOnBytecode(int, unsigned long*, v8::internal::Isolate*) ()
#11 0x00007f6837e76876 in ?? ()
#12 0x0000560f38837aa0 in ?? ()
#13 0x00007fff61397cf0 in ?? ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    inspectorIssues and PRs related to the V8 inspector protocolv8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions