Skip to content

Segfault with recent versions of Node and native VS Code debugging #58245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
darcyrush opened this issue May 9, 2025 · 0 comments
Open

Segfault with recent versions of Node and native VS Code debugging #58245

darcyrush opened this issue May 9, 2025 · 0 comments

Comments

@darcyrush
Copy link

Version

v23.11.0, v24.0.0, v24.0.1

Platform

Linux P3 6.8.0-59-generic #61~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 17:03:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Unfortunately I am unable to provide a minimal reproduction repository.

I am running my code via VS-Codium's native debugging (launch.json) and on recent versions I receive Segmentation fault (core dumped). When I execute the same command (the console output of the command VS-Codium runs, but without VS-Codium attaching its native debugger to node) on command line the application executes as expected.

The command VS-Codium executes is the following;

/usr/bin/env TS_NODE_PROJECT=/path/to/tsconfig.json 'ENV_ONE=VALUE_ONE' 'ENV_TWO=VALUE_TWO' ENV_THREE=VALUE_THREE ENV_FOUR=VALUE_FOUR 'NODE_OPTIONS= --require /usr/share/codium/resources/app/extensions/ms-vscode.js-debug/src/bootloader.js  --inspect-publish-uid=http' 'VSCODE_INSPECTOR_OPTIONS=:::{"inspectorIpc":"/tmp/node-cdp.83350-f9cd27da-1.sock","deferredMode":false,"waitForDebugger":"","execPath":"/usr/local/bin/node","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"/tmp/node-debug-callback-f9d390cd3c6fd40d"}' /usr/local/bin/node --require ts-node/register ./src/application/main.ts 

I am also using the n npm package to change node versions, so it is possible this is somehow an issue. That said, when I use n to switch to any version prior to 23.11.0, such as 23.10.0, everything works as expected.

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

Happens every time.

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

The application starts as normal, stopping on breakpoints within the code editor as with previous versions.

What do you see instead?

PID 83717 received SIGSEGV for address: 0x0
.../node_modules/segfault-handler/build/Release/segfault-handler.node(+0x33b0)[0x7d1e7607a3b0]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7d1e75a42520]
/usr/local/bin/node(_ZN2v87Context5EnterEv+0x11)[0x1334fb1]
/usr/local/bin/node(_ZN12v8_inspector14InjectedScript5Scope10initializeEv+0xf8)[0x1b0c838]
/usr/local/bin/node(_ZN12v8_inspector18V8RuntimeAgentImpl8evaluateERKNS_8String16ESt8optionalIS1_ES4_IbES6_S4_IiES6_S6_S6_S6_S6_S4_IdES6_S6_S6_S5_St10unique_ptrINS_8protocol7Runtime20SerializationOptionsESt14default_deleteISC_EES9_INSB_7Backend16EvaluateCallbackESD_ISH_EE+0x211)[0x1b84421]
/usr/local/bin/node(_ZN12v8_inspector8protocol7Runtime20DomainDispatcherImpl8evaluateERKN8v8_crdtp12DispatchableE+0x2a4)[0x1be8ec4]
/usr/local/bin/node(_ZN8v8_crdtp14UberDispatcher14DispatchResult3RunEv+0x1b)[0x1bab71b]
/usr/local/bin/node(_ZN12v8_inspector22V8InspectorSessionImpl23dispatchProtocolMessageENS_10StringViewE+0x1b8)[0x1b71318]
/usr/local/bin/node[0x12542b4]
/usr/local/bin/node[0x12782b1]
/usr/local/bin/node[0x1275f3e]
/usr/local/bin/node[0x12762a3]
/usr/local/bin/node[0x1276c54]
/usr/local/bin/node(_ZN4node11Environment21RunAndClearInterruptsEv+0x148)[0xfe1088]
/usr/local/bin/node[0xfe10f2]
/usr/local/bin/node(_ZN2v88internal7Isolate27InvokeApiInterruptCallbacksEv+0x6a)[0x14f5bca]
/usr/local/bin/node(_ZN2v88internal10StackGuard16HandleInterruptsENS1_14InterruptLevelE+0x12f)[0x151507f]
/usr/local/bin/node(_ZN2v88internal18Runtime_StackGuardEiPmPNS0_7IsolateE+0x8e)[0x1a7a01e]
[0x7d1e17e76636]
Segmentation fault (core dumped)

Additional information

Output of find node_modules -iname *.node

node_modules/@napi-rs/canvas-linux-x64-musl/skia.linux-x64-musl.node
node_modules/@napi-rs/canvas-linux-x64-gnu/skia.linux-x64-gnu.node
node_modules/segfault-handler/build/Release/segfault-handler.node
node_modules/segfault-handler/build/Release/obj.target/segfault-handler.node

Output of which node

/usr/local/bin/node

Output of node --version

v24.0.1

A possible red-herring, but could be related;

$ n i 24.0.1
     copying : node/24.0.1
   installed : v24.0.1 (with npm 11.3.0)

Note: the node command changed location and the old location may be remembered in your current shell.
         old : /usr/bin/node
         new : /usr/local/bin/node
If "node --version" shows the old version then start a new shell, or reset the location hash with:
hash -r  (for bash, zsh, ash, dash, and ksh)
rehash   (for csh and tcsh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant