Giter Site home page Giter Site logo

Comments (1)

jfolker avatar jfolker commented on June 29, 2024

I'm getting a segfault of my own just from including the "segfault-handler" module. It doesn't make it far enough in to set its own signal handler routine before the SEGV occurs.

Here is the first few lines of my reproduction:

const config = require('../config.json');

// TODO: This module has not been updated in over 4 years, but its functionality is vital.
// Ironically, the current version of this module running in the latest stable version of
// nodejs segfaults before it can even get far enough into its own initialization to report
// a stack trace.
var SegfaultHandler = require('segfault-handler');
//SegfaultHandler.registerHandler('logs/lsstream_crash.log');
process.exit(1);

It should exit with status 1 immediately after loading "segfault-handler", but instead it just unceremoniously segfaults during a wrapper function around dlopen:

jfolker-local@jfolker-ubuntu1:~/git/lscat/lsnode/backend$ node lsstream.js 
Segmentation fault (core dumped)

Can you try running your nodejs script under gdb and post your stack trace? I wanna see if yours is similar to mine:

jfolker-local@jfolker-ubuntu1:~/git/lscat/lsnode/backend$ gdb node
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from node...
(gdb) r lsstream.js
Starting program: /home/jfolker-local/.nvm/versions/node/v20.11.1/bin/node lsstream.js
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff77ff640 (LWP 869426)]
[New Thread 0x7ffff6ffe640 (LWP 869427)]
[New Thread 0x7ffff67fd640 (LWP 869428)]
[New Thread 0x7ffff5ffc640 (LWP 869429)]
[New Thread 0x7ffff57fb640 (LWP 869430)]
[New Thread 0x7ffff7fba640 (LWP 869431)]

Thread 1 "node" received signal SIGSEGV, Segmentation fault.
0x00007fffce01a985 in ?? () from /lib/x86_64-linux-gnu/libnode.so.72
(gdb) bt
#0  0x00007fffce01a985 in ?? () from /lib/x86_64-linux-gnu/libnode.so.72
#1  0x00007ffff7fc947e in call_init (l=<optimized out>, argc=argc@entry=2, argv=argv@entry=0x7fffffffe2f8, env=env@entry=0x7fffffffe310)
    at ./elf/dl-init.c:70
#2  0x00007ffff7fc9568 in call_init (env=0x7fffffffe310, argv=0x7fffffffe2f8, argc=2, l=<optimized out>) at ./elf/dl-init.c:33
#3  _dl_init (main_map=0x5673330, argc=2, argv=0x7fffffffe2f8, env=0x7fffffffe310) at ./elf/dl-init.c:117
#4  0x00007ffff7974af5 in __GI__dl_catch_exception (exception=<optimized out>, operate=<optimized out>, args=<optimized out>)
    at ./elf/dl-error-skeleton.c:182
#5  0x00007ffff7fd0ff6 in dl_open_worker (a=0x7fffffffc280) at ./elf/dl-open.c:808
#6  dl_open_worker (a=a@entry=0x7fffffffc280) at ./elf/dl-open.c:771
#7  0x00007ffff7974a98 in __GI__dl_catch_exception (exception=<optimized out>, operate=<optimized out>, args=<optimized out>)
    at ./elf/dl-error-skeleton.c:208
#8  0x00007ffff7fd134e in _dl_open (file=<optimized out>, mode=-2147483647, 
    caller_dlopen=0xc6a2be <std::_Function_handler<bool (node::binding::DLib*), node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::{lambda(node::binding::DLib*)#1}>::_M_invoke(std::_Any_data const&, node::binding::DLib*&&)+62>, nsid=-2, argc=2, 
    argv=<optimized out>, env=0x7fffffffe310) at ./elf/dl-open.c:883
#9  0x00007ffff789063c in dlopen_doit (a=a@entry=0x7fffffffc4f0) at ./dlfcn/dlopen.c:56
#10 0x00007ffff7974a98 in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffc450, operate=<optimized out>, args=<optimized out>)
    at ./elf/dl-error-skeleton.c:208
#11 0x00007ffff7974b63 in __GI__dl_catch_error (objname=0x7fffffffc4a8, errstring=0x7fffffffc4b0, mallocedp=0x7fffffffc4a7, 
    operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:227
#12 0x00007ffff789012e in _dlerror_run (operate=operate@entry=0x7ffff78905e0 <dlopen_doit>, args=args@entry=0x7fffffffc4f0)
    at ./dlfcn/dlerror.c:138
#13 0x00007ffff78906c8 in dlopen_implementation (dl_caller=<optimized out>, mode=<optimized out>, file=<optimized out>)
    at ./dlfcn/dlopen.c:71
#14 ___dlopen (file=<optimized out>, mode=<optimized out>) at ./dlfcn/dlopen.c:81
#15 0x0000000000c6a2be in std::_Function_handler<bool (node::binding::DLib*), node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::{lambda(node::binding::DLib*)#1}>::_M_invoke(std::_Any_data const&, node::binding::DLib*&&) ()
#16 0x0000000000c1a14e in node::Environment::TryLoadAddon(char const*, int, std::function<bool (node::binding::DLib*)> const&) ()
#17 0x0000000000c69819 in node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&) ()
#18 0x0000000000f328df in v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) ()
#19 0x0000000000f3314d in v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, unsigned long*, int) ()
#20 0x0000000000f33615 in v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) ()
#21 0x000000000193cdf6 in Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit ()
#22 0x00000000018aed1c in Builtins_InterpreterEntryTrampoline ()
#23 0x00000405422004e9 in ?? ()
#24 0x0000383fdf047711 in ?? ()
#25 0x0000000700000000 in ?? ()
#26 0x00000405422005b9 in ?? ()
#27 0x0000383fdf043851 in ?? ()
#28 0x00002758e77054b1 in ?? ()
#29 0x00002758e77048c9 in ?? ()
#30 0x0000036d7281d141 in ?? ()
#31 0x00002758e77048c9 in ?? ()
#32 0x00000405422004e9 in ?? ()

from node-segfault-handler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.