Giter Site home page Giter Site logo

ddopson / node-segfault-handler Goto Github PK

View Code? Open in Web Editor NEW
315.0 11.0 75.0 70 KB

Tool for debugging native Node.js modules and getting stack traces when things go wrong.

License: BSD 3-Clause "New" or "Revised" License

Python 1.72% JavaScript 0.72% C++ 97.56%

node-segfault-handler's Introduction

Overview

This module is a critical tool for debugging Node.js C/C++ native code modules, and is safe to use in production environments. Normally, when a bug is triggered in native code, the node process simply ends with no helpful information. In production, this can manifest as worker processes restarting for seemingly no reason. Running node in gdb is messy and infeasible for a production environment. Instead this module will sit unobtrusively doing nothing (zero perf impact) as long as Node is well-behaved. If a SIGSEGV signal is raised, the module will print a native stack trace to both STDERR and to a timestamped file (STDERR is usually ignored in production environments; files are better).

Using the module is as simple as:

var SegfaultHandler = require('segfault-handler');

SegfaultHandler.registerHandler("crash.log"); // With no argument, SegfaultHandler will generate a generic log file name

// Optionally specify a callback function for custom logging. This feature is currently only supported for Node.js >= v0.12 running on Linux.
SegfaultHandler.registerHandler("crash.log", function(signal, address, stack) {
	// Do what you want with the signal, address, or stack (array)
	// This callback will execute before the signal is forwarded on.
});

SegfaultHandler.causeSegfault(); // simulates a buggy native module that dereferences NULL

Obviously, you would only include the first two lines in your own code; the third is for testing purposes and to demonstrate functionality.

After running the above sample, you will see a stacktrace on OSX and Linux that looks like:

PID 67926 received SIGSEGV for address: 0x0
0   segfault-handler-native.node        0x00000001007e83d6 _ZL16segfault_handleriP9__siginfoPv + 235
1   libSystem.B.dylib                   0x00007fff844d11ba _sigtramp + 26
2   ???                                 0x00007fff5fc404a0 0x0 + 140734800069792
3   segfault-handler-native.node        0x00000001007e80fd _Z22segfault_stack_frame_2v + 9
4   segfault-handler-native.node        0x00000001007e82d4 _Z13CauseSegfaultRKN2v89ArgumentsE + 17
5   node                                0x00000001000a45de _ZN2v88internalL21Builtin_HandleApiCallENS0_12_GLOBAL__N_116BuiltinArgumentsILNS0_21BuiltinExtraArgumentsE1EEEPNS0_7IsolateE + 430

And on Windows:

PID 11880 received SIGSEGV for address: 0xfe101419
SymInit: Symbol-SearchPath: '.;c:\github\node-segfault-handler;c:\Program Files\nodejs;C:\Windows;C:\Windows\system32;SRV*C:\websymbols*http://msdl.microsoft.com/download/symbols;', symOptions: 530, UserName: 'tylerw'
OS-Version: 6.3.9600 () 0x100-0x1
c:\github\node-segfault-handler\src\stackwalker.cpp (941): StackWalker::ShowCallstack
c:\github\node-segfault-handler\src\segfault-handler.cpp (114): segfault_handler
00007FFF0A2622C7 (ntdll): (filename not available): RtlNormalizeString
00007FFF0A2138FE (ntdll): (filename not available): RtlWalkFrameChain
00007FFF0A29544A (ntdll): (filename not available): KiUserExceptionDispatcher
c:\github\node-segfault-handler\src\segfault-handler.cpp (138): segfault_stack_frame_1
c:\github\node-segfault-handler\node_modules\nan\nan_callbacks_12_inl.h (175): Nan::imp::FunctionCallbackWrapper
00007FF64489D4A9 (node): (filename not available): v8::Unlocker::~Unlocker
00007FF644865E90 (node): (filename not available): v8::Unlocker::~Unlocker
00007FF644863D79 (node): (filename not available): v8::Unlocker::~Unlocker
00000000C3D060A6 ((module-name not available)): (filename not available): (function-name not available)
000000E36B69E3F8 ((module-name not available)): (filename not available): (function-name not available)
00000000C3D43D02 ((module-name not available)): (filename not available): (function-name not available)

Be aware that in production environments, pdb files must be included as part of your install to resolve names / lines in Windows stack traces.

Now you can start debugging using tools like objdump -dS module.node to try and sort out what the stack actually means. Sometimes, just identifying which native module is causing problems is the biggest win.

Cheers, enjoy. And happy hunting.

Contributors

  • Dave Dopson (@ddopson): original author and founder of the project
  • Tyler Ang-Wanek (@implausible)
  • Anton Whalley (@No9)
  • Tristan Colgate-McFarlane (@tcolgate)
  • Jan (@relovution)
  • Mikael Korpela (@simison)
  • Benjamin Byholm (@kkoopa)
  • Tim Kevin Oxley (@timoxley)
  • Thomas P (@TPXP)
  • Byron Clark (@byronclark)
  • Mi Tar (@mitar)
  • Rolf Sommerhalder (@hb9cwp)
  • Mark Smith (@markmsmith)
  • Paul-Maxime (@paul-maxime)
  • Ștefan-Gabriel Muscalu (@legraphista)
  • Matt Esch (@Matt-Esch)
  • Kenneth Geisshirt (@kneth): current maintainer

If you are a contributor and are missing, please create a pull request.

License

This software is licensed for use under the BSD license.

We are using the callstack walker project which is also BSD licensed.

node-segfault-handler's People

Contributors

byronclark avatar ddopson avatar hb9cwp avatar implausible avatar kkoopa avatar kneth avatar legraphista avatar mitar avatar no9 avatar paul-maxime avatar pierreinglebert avatar relovution avatar simison avatar timoxley avatar tpxp avatar uberesch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-segfault-handler's Issues

Error when building on electron

With certain versions of NodeJS, we are encountering errors when rebuilding this dependency using electron-builder:

It works in Node 16.3

Does not work in Node 16.16:

• electron-builder  version=22.11.7 os=21.5.0
  • loaded configuration  file=/var/folders/63/sz2y_mcj6jl0kcxtd8szkckc0000gp/T/tmp-28175-BXEvpGscumnI
  • author is missed in the package.json  appPackageFile=/Users/chardy/code/project/src/package.json
  • writing effective config  file=release/development/builder-effective-config.yaml
  • rebuilding native dependencies  [email protected] platform=darwin arch=arm64
  • rebuilding native dependency  name=segfault-handler version=1.3.0
  ⨯ cannot execute  cause=exit status 1
                    out=$ node-gyp rebuild
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

                    errorOut=gyp info it worked if it ends with ok
    gyp info using [email protected]
    gyp info using [email protected] | darwin | arm64
    gyp info find Python using Python version 3.8.9 found at "/Applications/Xcode.app/Contents/Developer/usr/bin/python3"
    gyp info spawn /Applications/Xcode.app/Contents/Developer/usr/bin/python3
    gyp info spawn args [
    gyp info spawn args   '/Users/chardy/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
    gyp info spawn args   'binding.gyp',
    gyp info spawn args   '-f',
    gyp info spawn args   'make',
    gyp info spawn args   '-I',
    gyp info spawn args   '/Users/chardy/code/project/src/node_modules/segfault-handler/build/config.gypi',
    gyp info spawn args   '-I',
    gyp info spawn args   '/Users/chardy/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
    gyp info spawn args   '-I',
    gyp info spawn args   '/Users/chardy/.electron-gyp/11.5.0/include/node/common.gypi',
    gyp info spawn args   '-Dlibrary=shared_library',
    gyp info spawn args   '-Dvisibility=default',
    gyp info spawn args   '-Dnode_root_dir=/Users/chardy/.electron-gyp/11.5.0',
    gyp info spawn args   '-Dnode_gyp_dir=/Users/chardy/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/node-gyp',
    gyp info spawn args   '-Dnode_lib_file=/Users/chardy/.electron-gyp/11.5.0/<(target_arch)/node.lib',
    gyp info spawn args   '-Dmodule_root_dir=/Users/chardy/code/project/src/node_modules/segfault-handler',
    gyp info spawn args   '-Dnode_engine=v8',
    gyp info spawn args   '--depth=.',
    gyp info spawn args   '--no-parallel',
    gyp info spawn args   '--generator-output',
    gyp info spawn args   'build',
    gyp info spawn args   '-Goutput_dir=.'
    gyp info spawn args ]
    gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
    gyp ERR! configure error 
    gyp ERR! stack Error: `gyp` failed with exit code: 1
    gyp ERR! stack     at ChildProcess.onCpExit (/Users/chardy/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
    gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
    gyp ERR! System Darwin 21.5.0
    gyp ERR! command "/Users/chardy/.nvm/versions/node/v16.16.0/bin/node" "/Users/chardy/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /Users/chardy/code/project/src/node_modules/segfault-handler
    gyp ERR! node -v v16.16.0
    gyp ERR! node-gyp -v v9.0.0
    gyp ERR! not ok 
    error Command failed with exit code 1.

SIGSEGV in 0.0.64

There is still some memory-related issue which very rarely happens for me locally and sometimes on CI:

PID 16417 received SIGSEGV for address: 0x0
/web/github/detox-core/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x1b19)[0x7f8c20d34b19]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x13150)[0x7f8c2332e150]
node(_ZN2v86Object3GetENS_5LocalINS_5ValueEEE+0xa)[0xaf766a]
/web/github/detox-core/node_modules/wrtc/build/wrtc/v0.0.64/Release/node-v59-linux-x64/wrtc.node(_ZN11node_webrtc14PeerConnection3RunEP10uv_async_si+0x5a4)[0x7f8c201953a4]
node[0x1418ceb]
node[0x142abd8]
node(uv_run+0x156)[0x1419676]
node(_ZN4node5StartEP9uv_loop_siPKPKciS5_+0x4dd)[0x11fca6d]
node(_ZN4node5StartEiPPc+0x153)[0x11f93e3]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f8c22f5c1c1]
node[0x89c371]

I'm currently investigating where and why it happens.

Registry Free Dll for a Com DLL

I am new to node-gyp and facing a serious problem and stuck in the middle.

Issue:-
We are using a node server to load a normal C++ DLL which internally loads a COM DLL.
The workflow is like the front-end javascript will call the node server which will call the DLL functionality. The DLL uses a third party COM DLL to achieve the functionality.
javascript->node->Normal DLL->COM DLL

Since the third party DLL is a COM DLL, it needs to be registered. But we had a requirement not to register the same.By following the instructions in the below link we can achieve this.
http://blogs.msdn.com/b/yvesdolc/archive/2008/05/09/native-manifests-let-s-do-com-and-forget-the-registry.aspx
i.e. we need to add some settings in the third party COM dll and the DLL/Exe which loads the COM dll.

This will work fine if the DLL is loaded by an exe. But in our case, it is loaded by node server.
Let the COM dll already had the settings to make it registry free. Hence if the com DLL is loaded by another DLL, which is loaded by an exe, then the setting need to be done in the EXE.
Exe->Normal DLL->COM DLL

But in our case the workflow is as below.
node->Normal DLL->COM DLL

Hence we need to add the settings in the node and buid it.
Settings needed to be added is "type='x64' name='COM_DLL_NAME' version='1.0.0.0'".
We were able to build the node sever with the settings.

'msbuild_settings': {
'Link': {
'GenerateDebugInformation': 'true',
'AdditionalManifestDependencies': "type='x64' name='COM_DLL_NAME' version='1.0.0.0'",
},
},

But the COM dll is not loaded. i.e. cocreateInstance of the COM DLL is failing.
Any help will be appreciated.

Symbol segfault_handler_native_module not found

Attempting to require this module gives the error: Symbol segfault_handler_native_module not found. This is from an empty project. node v0.10.25, linux mint 16.

Incidentally, while installing it I saw the warning:

make: Entering directory `/home/koromori/test/node_modules/segfault-handler/build'
  CXX(target) Release/obj.target/segfault-handler-native/src/segfault-handler.o
../src/segfault-handler.cpp: In function ‘void segfault_handler(int, siginfo_t*, void*)’:
../src/segfault-handler.cpp:39:33: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
   if(fd > 0) write(fd, sbuff, n);
                                 ^
../src/segfault-handler.cpp:40:29: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
   write(STDERR_FD, sbuff, n);

Installation issues on linux

Thanks for your work on this module. It works perfectly on OSX. However, I've not been able to install it on linux. A quick search of this repo's issue history indicates there are others with similar problems.

node is version 4.4.2
npm is version 2.15.0
node-gyp is version 3.3.1

Full error message:

> [email protected] install /var/www/Journal/node_modules/segfault-handler
> node-gyp rebuild

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
Traceback (most recent call last):
  File "/home/ec2-user/.nvm/v4.4.2/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "/home/ec2-user/.nvm/v4.4.2/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "/home/ec2-user/.nvm/v4.4.2/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 538, in main
    return gyp_main(args)
  File "/home/ec2-user/.nvm/v4.4.2/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 514, in gyp_main
    options.duplicate_basename_check)
  File "/home/ec2-user/.nvm/v4.4.2/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 130, in Load
    params['parallel'], params['root_targets'])
  File "/home/ec2-user/.nvm/v4.4.2/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2775, in Load
    variables, includes, depth, check, True)
  File "/home/ec2-user/.nvm/v4.4.2/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 391, in LoadTargetBuildFile
    includes, True, check)
  File "/home/ec2-user/.nvm/v4.4.2/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 243, in LoadOneBuildFile
    None)
  File "binding.gyp", line 1
    {
     ^
SyntaxError: invalid syntax
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/ec2-user/.nvm/v4.4.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.14.44-32.39.amzn1.x86_64
gyp ERR! command "/home/ec2-user/.nvm/v4.4.2/bin/node" "/home/ec2-user/.nvm/v4.4.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/Journal/node_modules/segfault-handler
gyp ERR! node -v v4.4.2
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Linux 3.14.44-32.39.amzn1.x86_64
npm ERR! argv "/home/ec2-user/.nvm/v4.4.2/bin/node" "/home/ec2-user/.nvm/v4.4.2/bin/npm" "install" "segfault-handler"
npm ERR! node v4.4.2
npm ERR! npm  v2.15.0
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the segfault-handler package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs segfault-handler
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls segfault-handler
npm ERR! There is likely additional logging output above.

Segfault handler should abort, or have the option to abort

The segfault handler implementation on linux relies on the default handler to abort the process. It's doing this by setting the SA_RESETHAND flag, which reverts the handler to the default after the first execution. Incidentally this feature is a leftover artifact from a bug where the segfault handler used to get reset when it wasn't supposed to, and this flag restored the old buggy behaviour. So this implies that a segfault must occur twice for the process to exit. The first time the custom handler is called and the second time the default handler is called.

For example, this is obvious if you manually kill -SIGSEGV $pid - you have to send the signal twice, once to trap for the segfault handler and the second time is trapped by the default.

After the segfault has been trapped, the machine instruction is replayed. If replaying that instruction fails, the process will segfault again, and because the default handler has kicked in, the process will abort. There are however some situations where the replay will succeed. For example, if you're reading an area of memory that was not allocated when the fault was raised and the memory region is then allocated by another thread in the process.

Essentially the segfault handler should manually abort the process in the event of sigsegv rather than relying on the instruction to segfault twice, because this is unreliable.

I have worked around this by manually adding process.abort() to my custom handler, but this shouldn't be necessary.

Node-gyp compile error

Windows 7 machine, compiling with VS2013 express for Desktop.
node -v v0.10.32
npm -v 1.4.28

Node-gyp compiles fine for other modules (e.g. libxmljs), but fails here.

C:\Users\mcdonnel\Documents\validator\node_modules\segfault-handler>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
segfault-handler.cpp
..\src\segfault-handler.cpp(2): fatal error C1083: Cannot open include file: 'execinfo.h': No such file or directory [C:\Users\mcdonnel\Documents\validator\node_modules\segfault-handler\build\segfault-handler.vcxproj]
gyp
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the segfault-handler package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls segfault-handler
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "[email protected]" "segfault-handler"
npm ERR! cwd C:\Users\mcdonnel\Documents\validator
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE

Any suggestions would be appreciated. Thanks!

Node 10 Compatibility

Hi there,

I was unable to do a node-gyp rebuild with the last Node version (10.0).
I have an error saying that "v8-debug.h" is not found.

Any idea on what's going wrong ? Is this package compatible with node 10 ?

Thanks !

Crash log only contains SIGSEGV and /lib/libc.so.6

Hello,

I am using this lib to debug a crash that occurs randomly in an application which is running on a raspberry pi with a very barebones unix OS. The crash is very hard to reproduce consistently, the app can run for hours with no problems and will sometimes crash after a few minutes.

Here is the log I get after adding node-segfault-handler:

PID 386 received SIGSEGV for address: 0x3f5e2ca8
/usr/lib/node/prod/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x1b2e)[0xb429bb2e]
/lib/libc.so.6(+0x2a300)[0xb6639300]

I was hoping it would point me in the direction of one of the native modules that the app is using, but the log turns out to be not very helpful ^^

I am a bit out of my depth here, and would appreciate it if someone could help me understand what is going on:

  • does this log completely rule out the native modules I am using as the source of the crashes ?
  • is the "libc.so.6" in the stack a clue for finding the cause of the crash, or is just a part of the segfault-handler logging mechanism ?
  • is there anything I can do to make this log a bit more verbose ?

Thanks

Handler segfaults itself when using multiple v8 isolates

In segfault-handler.cpp:113 the only check to determine if you're currently in the nodejs isolate is if (Isolate::GetCurrent()) which is not correct in multi-isolate environments (see my project: isolated-vm). So if a segfault is hit while in a different isolate the segfault handler will segfault itself when it tries to call a callback belonging to a different isolate.

It should be simple enough to grab a reference to the current isolate when the module is loaded and then compare against that in the segfault handler.

Node-pre-gyp support

Hey guys, I'm working on getting all of the native modules we use in Gitkraken on node-pre-gyp, and this includes providing prebuilt binaries for both vanilla node and electron across windows/osx/linux. I'm fairly sure I can get the required AWS hosting provided, and I can add the necessary CI etc, if that's something you guys are open to.
Just wanted to see if that's something you'd be cool with before I dig in and make a PR.

Does not build properly on Mac OSX

After installing and building on Mac OSX 10.8.6.

rtruong@Randals-MacBook-Air-2:~/lever/ats/node_modules/segvcatcher (master) $ node example.js 

module.js:485
  process.dlopen(filename, module.exports);
          ^
Error: dlopen(/Users/rtruong/lever/ats/node_modules/segvcatcher/build/Release/segvhandler_native.node, 1): no suitable image found.  Did find:
    /Users/rtruong/lever/ats/node_modules/segvcatcher/build/Release/segvhandler_native.node: mach-o, but wrong architecture
    at Object.Module._extensions..node (module.js:485:11)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/Users/rtruong/lever/ats/node_modules/segvcatcher/lib/segvhandler.js:7:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

Also as perhaps a separate issue the the "main" reference in package.json should read:

  "main": "lib/segvhandler.js",

Bump version to pull node 0.10.x compatible version

Is it possible to bump the version number to allow the npm registry to pull the node 0.10.x compatible build?

As it stands now we are using segfault-handler in a node 0.10.5 app and we need to manually build and install the most recent version from source and overwrite the npm install with that. Which is quite doable, but it's a bit of a pain to special case the build scripts.

thanks, I can create a pull request if that would be helpful or if you could clarify if it's not ready for release or something like that that I'm missing that would also be great.

callback is never called

Hi there,

Am I doing something wrong? or it's a known issue?

I've the following code:

SegfaultHandler.registerHandler("crash.log", function(signal, address, stack) {
  console.log('TETETETETETETETET');
});

SegfaultHandler.causeSegfault();

I've never seen my message from the callback. And the log filename is like that stacktrace-1512461249-10000.log. The numbers (in the filename) every time are different.

But if I remove the callback, the log stores under the "crash.log" filename.

I'm using
"segfault-handler": "1.0.0" and node: v8.9.1

Thanks

Is the register handler callback broken?

    SegfaultHandler.registerHandler('crash.log', function(signal, address, stack) {
        console.log('here!')
    })

    SegfaultHandler.causeSegfault()

here! is never printed. A bug or am I doing something wrong?

Installation failed

openSUSE 13.1, G++ 4.8, node.js 0.11

npm install git://github.com/ddopson/node-segfault-handler.git --nodedir=/home/rush/Programowanie/node
npm WARN package.json [email protected] No repository field.
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

> [email protected] install /home/rush/Programowanie/http-master/node_modules/segfault-handler
> node-gyp rebuild

make: Entering directory `/home/rush/Programowanie/http-master/node_modules/segfault-handler/build'
  CXX(target) Release/obj.target/segfault_handler/src/segfault-handler.o
In file included from /home/rush/Programowanie/node/src/node.h:61:0,
                 from ../src/segfault-handler.cpp:11:
/home/rush/Programowanie/node/deps/v8/include/v8.h: In member function 'void v8::ReturnValue<T>::Set(uint32_t)':
/home/rush/Programowanie/node/deps/v8/include/v8.h:5816:31: warning: typedef 'I' locally defined but not used [-Wunused-local-typedefs]
   typedef internal::Internals I;
                               ^
../src/segfault-handler.cpp: At global scope:
../src/segfault-handler.cpp:21:39: error: 'siginfo_t' has not been declared
 static void segfault_handler(int sig, siginfo_t *si, void *unused) {
                                       ^
../src/segfault-handler.cpp: In function 'void segfault_handler(int, int*, void*)':
../src/segfault-handler.cpp:38:102: error: request for member 'si_addr' in '* si', which is of non-class type 'int'
   n = snprintf(sbuff, sizeof(sbuff), "PID %d received SIGSEGV for address: 0x%lx\n", pid, (long) si->si_addr);
                                                                                                      ^
../src/segfault-handler.cpp: At global scope:
../src/segfault-handler.cpp:75:35: error: 'Arguments' does not name a type
 Handle<Value> CauseSegfault(const Arguments& args) {
                                   ^
../src/segfault-handler.cpp:75:46: error: ISO C++ forbids declaration of 'args' with no type [-fpermissive]
 Handle<Value> CauseSegfault(const Arguments& args) {
                                              ^
../src/segfault-handler.cpp:82:37: error: 'Arguments' does not name a type
 Handle<Value> RegisterHandler(const Arguments& args) {
                                     ^
../src/segfault-handler.cpp:82:48: error: ISO C++ forbids declaration of 'args' with no type [-fpermissive]
 Handle<Value> RegisterHandler(const Arguments& args) {
                                                ^
../src/segfault-handler.cpp: In function 'v8::Handle<v8::Value> RegisterHandler(const int&)':
../src/segfault-handler.cpp:83:20: error: aggregate 'RegisterHandler(const int&)::sigaction sa' has incomplete type and cannot be defined
   struct sigaction sa;
                    ^
../src/segfault-handler.cpp:84:41: error: invalid application of 'sizeof' to incomplete type 'RegisterHandler(const int&)::sigaction'
   memset(&sa, 0, sizeof(struct sigaction));
                                         ^
../src/segfault-handler.cpp:85:26: error: 'sigemptyset' was not declared in this scope
   sigemptyset(&sa.sa_mask);
                          ^
../src/segfault-handler.cpp:87:19: error: 'SA_SIGINFO' was not declared in this scope
   sa.sa_flags   = SA_SIGINFO;
                   ^
../src/segfault-handler.cpp:88:13: error: 'SIGSEGV' was not declared in this scope
   sigaction(SIGSEGV, &sa, NULL);
             ^
../src/segfault-handler.cpp:88:31: error: invalid use of incomplete type 'struct RegisterHandler(const int&)::sigaction'
   sigaction(SIGSEGV, &sa, NULL);
                               ^
../src/segfault-handler.cpp:83:10: error: forward declaration of 'struct RegisterHandler(const int&)::sigaction'
   struct sigaction sa;
          ^
../src/segfault-handler.cpp: In function 'void init(v8::Handle<v8::Object>)':
../src/segfault-handler.cpp:94:63: error: no matching function for call to 'NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [16], v8::Handle<v8::Value> (&)(const int&))'
     NODE_SET_METHOD(target, "registerHandler", RegisterHandler);
                                                               ^
../src/segfault-handler.cpp:94:63: note: candidate is:
In file included from ../src/segfault-handler.cpp:11:0:
/home/rush/Programowanie/node/src/node.h:191:13: note: template<class TypeName> void node::NODE_SET_METHOD(const TypeName&, const char*, v8::FunctionCallback)
 inline void NODE_SET_METHOD(const TypeName& recv,
             ^
/home/rush/Programowanie/node/src/node.h:191:13: note:   template argument deduction/substitution failed:
../src/segfault-handler.cpp:94:63: note:   cannot convert 'RegisterHandler' (type 'v8::Handle<v8::Value>(const int&)') to type 'v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}'
     NODE_SET_METHOD(target, "registerHandler", RegisterHandler);
                                                               ^
../src/segfault-handler.cpp:95:59: error: no matching function for call to 'NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [14], v8::Handle<v8::Value> (&)(const int&))'
     NODE_SET_METHOD(target, "causeSegfault", CauseSegfault);
                                                           ^
../src/segfault-handler.cpp:95:59: note: candidate is:
In file included from ../src/segfault-handler.cpp:11:0:
/home/rush/Programowanie/node/src/node.h:191:13: note: template<class TypeName> void node::NODE_SET_METHOD(const TypeName&, const char*, v8::FunctionCallback)
 inline void NODE_SET_METHOD(const TypeName& recv,
             ^
/home/rush/Programowanie/node/src/node.h:191:13: note:   template argument deduction/substitution failed:
../src/segfault-handler.cpp:95:59: note:   cannot convert 'CauseSegfault' (type 'v8::Handle<v8::Value>(const int&)') to type 'v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}'
     NODE_SET_METHOD(target, "causeSegfault", CauseSegfault);
                                                           ^
make: *** [Release/obj.target/segfault_handler/src/segfault-handler.o] Error 1
make: Leaving directory `/home/rush/Programowanie/http-master/node_modules/segfault-handler/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:107:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1036:12)
gyp ERR! System Linux 3.11.10-7-desktop
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/rush/Programowanie/http-master/node_modules/segfault-handler
gyp ERR! node -v v0.11.12-pre
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the segfault-handler package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls segfault-handler
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.11.10-7-desktop
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "git://github.com/ddopson/node-segfault-handler.git" "--nodedir=/home/rush/Programowanie/node"
npm ERR! cwd /home/rush/Programowanie/http-master
npm ERR! node -v v0.11.12-pre
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/rush/Programowanie/http-master/npm-debug.log
npm ERR! not ok code 0

Electron 7.x.x and > throws context aware warning

When loading the segfault handler in Electron 7.x.x and greater there is a warning in the output:

(node:39360) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

Is this something that is tricky to have implemented? It doesn't look critical in the stable version of Electron but will stop working in the future. We really appreciate the utility of segfault-handler and the work that has gone into it.

No one on our team really understands what it would take to create a PR - we would be very happy to help test.

Suggested update to usage.

Just a minor update to the README, must install bindings before using so explicitly stating to run:

npm install bindings

would eliminate the only error I had in between downloading and using.

question: requiring this module fixes my segfault problem. What am I doing? :-D

Leaving this here where maybe people with some experience debugging node native modules might suggest some ideas.

I'm having a problem with a native node module crashing. That module is here: https://github.com/webosose/nodejs-module-webos-sysbus

While trying to track down the point of the crash, I discovered node-segfault-handler. I built that for the target system, and I require it as the very first thing in my source. The crashing has stopped completely (well , at least for the first 500 attempts . . it was a random problem, but it was happening at least 1 in 10 times before)

Any ideas what might cause something like that?

I'm using nodejs 6.11.2 on the target environment, but that doesn't seem to make any difference.

Error building on Node 16.19.0

I've had an issue building the segfault-handler node module with npm since upgrading to node 16.19.0. It seems like there's a missing dependency: 127 error /Users/****/Library/Caches/node-gyp/16.19.0/include/node/v8.h:22:10: fatal error: atomic: No such file or directory

Here's the full log:

116 verbose stack Error: command failed
116 verbose stack     at ChildProcess.<anonymous> (/Users/****/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/lib/index.js:63:27)
116 verbose stack     at ChildProcess.emit (node:events:513:28)
116 verbose stack     at maybeClose (node:internal/child_process:1100:16)
116 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
117 verbose pkgid [email protected]
118 verbose cwd /Users/****/Code/****/*****
119 verbose Darwin 21.6.0
120 verbose node v16.19.0
121 verbose npm  v8.19.3
122 error code 1
123 error path /Users/****/Code/*****/*****/node_modules/segfault-handler
124 error command failed
125 error command sh -c -- node-gyp rebuild
126 error CXX(target) Release/obj.target/segfault-handler/src/segfault-handler.o
127 error gyp info it worked if it ends with ok
127 error gyp info using [email protected]
127 error gyp info using [email protected] | darwin | x64
127 error gyp info find Python using Python version 3.9.12 found at "/Users/****/opt/anaconda3/bin/python3"
127 error gyp info spawn /Users/****/opt/anaconda3/bin/python3
127 error gyp info spawn args [
127 error gyp info spawn args   '/Users/****/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp_main.py',
127 error gyp info spawn args   'binding.gyp',
127 error gyp info spawn args   '-f',
127 error gyp info spawn args   'make',
127 error gyp info spawn args   '-I',
127 error gyp info spawn args   '/Users/****/Code/*****/*****/node_modules/segfault-handler/build/config.gypi',
127 error gyp info spawn args   '-I',
127 error gyp info spawn args   '/Users/****/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi',
127 error gyp info spawn args   '-I',
127 error gyp info spawn args   '/Users/****/Library/Caches/node-gyp/16.19.0/include/node/common.gypi',
127 error gyp info spawn args   '-Dlibrary=shared_library',
127 error gyp info spawn args   '-Dvisibility=default',
127 error gyp info spawn args   '-Dnode_root_dir=/Users/****/Library/Caches/node-gyp/16.19.0',
127 error gyp info spawn args   '-Dnode_gyp_dir=/Users/****/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/@npmcli/run-script/node_modules/node-gyp',
127 error gyp info spawn args   '-Dnode_lib_file=/Users/****/Library/Caches/node-gyp/16.19.0/<(target_arch)/node.lib',
127 error gyp info spawn args   '-Dmodule_root_dir=/Users/****/Code/****/****t/node_modules/segfault-handler',
127 error gyp info spawn args   '-Dnode_engine=v8',
127 error gyp info spawn args   '--depth=.',
127 error gyp info spawn args   '--no-parallel',
127 error gyp info spawn args   '--generator-output',
127 error gyp info spawn args   'build',
127 error gyp info spawn args   '-Goutput_dir=.'
127 error gyp info spawn args ]
127 error gyp info spawn make
127 error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
127 error In file included from /Users/****/Library/Caches/node-gyp/16.19.0/include/node/node.h:73,
127 error                  from ../../nan/nan.h:60,
127 error                  from ../src/segfault-handler.cpp:2:
127 error /Users/****/Library/Caches/node-gyp/16.19.0/include/node/v8.h:22:10: fatal error: atomic: No such file or directory
127 error    22 | #include <atomic>
127 error       |          ^~~~~~~~
127 error compilation terminated.
127 error make: *** [Release/obj.target/segfault-handler/src/segfault-handler.o] Error 1
127 error gyp ERR! build error 
127 error gyp ERR! stack Error: `make` failed with exit code: 2
127 error gyp ERR! stack     at ChildProcess.onExit (/Users/****/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js:203:23)
127 error gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
127 error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
127 error gyp ERR! System Darwin 21.6.0
127 error gyp ERR! command "/Users/****/.nvm/versions/node/v16.19.0/bin/node" "/Users/****/.nvm/versions/node/v16.19.0/lib/node_modules/npm/node_modules/@npmcli/run-script/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
127 error gyp ERR! cwd /Users/****/Code/****/****/node_modules/segfault-handler
127 error gyp ERR! node -v v16.19.0
127 error gyp ERR! node-gyp -v v9.3.1
127 error gyp ERR! not ok
128 verbose exit 1

No stack trace printed nor does process exit.

I was having some trouble with my Heroku app exiting with status 139. I installed segfault-handler, but now this is all I get. No stack trace.

Apr 11 13:31:14 my-app app/worker.2: PID 3 received SIGSEGV for address: 0x0

The process doesn't exit anymore.

Please advise.

npm-gyp compile error on Win7

I get the same error on Windows 7 like tmcdonnell87 Issue #21- see below

C:\cygwin64\home\aggregator\node_modules\segfault-handler>node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
segfault-handler.cpp
..\src\segfault-handler.cpp(2): fatal error C1083: Cannot open include file: 'execinfo.h': No such file or directory [C:\cygwin64\home\aggregator\node_modules\segfault-handler\build\segfault-handler.vcxproj]
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the segfault-handler package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls segfault-handler
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! cwd C:\cygwin64\home\aggregator
npm ERR! node -v v0.10.41
npm ERR! npm -v 1.4.29
npm ERR! code ELIFECYCLE

What could be the root cause of the issue? Thanks

invalid ELF header

I am trying to use this module in an AWS lambda to debug a sporadic segmentation fault, but when I include this module I get an invalid ELF header error whenever it runs. Any help getting this to work would be appreciated.

2021-07-01T16:34:46.344Z	undefined	ERROR	Uncaught Exception 	
{
    "errorType": "Error",
    "errorMessage": "/var/task/node_modules/segfault-handler/build/Release/segfault-handler.node: invalid ELF header",
    "stack": [
        "Error: /var/task/node_modules/segfault-handler/build/Release/segfault-handler.node: invalid ELF header",
        "    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1057:18)",
        "    at Module.load (internal/modules/cjs/loader.js:863:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
        "    at Module.require (internal/modules/cjs/loader.js:887:19)",
        "    at require (internal/modules/cjs/helpers.js:74:18)",
        "    at bindings (/var/task/node_modules/bindings/bindings.js:112:48)",
        "    at Object.<anonymous> (/var/task/node_modules/segfault-handler/index.js:3:37)",
        "    at Module._compile (internal/modules/cjs/loader.js:999:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
        "    at Module.load (internal/modules/cjs/loader.js:863:32)"
    ]
}

Here is how I have it installed at the top of my lambda, unfortunately I cannot share the rest of my code.

const SegfaultHandler = require('segfault-handler');

SegfaultHandler.registerHandler('crash.log');

I am using "segfault-handler": "1.3.0" on node 12

Instalation problem

FreeBSD

npm install segfault-handler
npm WARN package.json [email protected] 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm http GET https://registry.npmjs.org/segfault-handler
npm http 200 https://registry.npmjs.org/segfault-handler
npm WARN package.json [email protected] No repository field.
npm http GET https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/bindings
npm http 200 https://registry.npmjs.org/bindings
npm ERR! Error: No compatible version found: bindings@'^1.2.1'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.1.0","0.1.1","0.2.0","0.2.1","0.2.2","0.2.3","0.2.4","0.3.0","0.4.0","1.0.0","1.1.0","1.1.1","1.2.0","1.2.1"]
npm ERR! at installTargetsError (/usr/home/xxx/.nvm/v0.8.25/lib/node_modules/npm/lib/cache.js:719:10)
npm ERR! at /usr/home/xxx/.nvm/v0.8.25/lib/node_modules/npm/lib/cache.js:641:10
npm ERR! at saved (/usr/home/xxx/.nvm/v0.8.25/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:138:7)
npm ERR! at Object.oncomplete (fs.js:297:15)
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System FreeBSD 10.1-RELEASE
npm ERR! command "/home/xxx/.nvm/v0.8.25/bin/node" "/home/xxx/.nvm/v0.8.25/bin/npm" "install" "segfault-handler"
npm ERR! cwd /usr/home/xxx
npm ERR! node -v v0.8.25
npm ERR! npm -v 1.2.30
npm http 200 https://registry.npmjs.org/nan
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/home/xxx/npm-debug.log
npm ERR! not ok code 0

Failing to run on Alpine Linux

Hi,

I'm trying to use this package on alpine linux using an official node image node:8-alpine

The npm i works but when starting the program I get this error:

/usr/app/node_modules/bindings/bindings.js:88
        throw e
        ^

Error: Error relocating /usr/app/node_modules/segfault-handler/build/Release/segfault-handler.node: backtrace: symbol not found
    at Object.Module._extensions..node (module.js:681:18)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at bindings (/usr/app/node_modules/bindings/bindings.js:81:44)
    at Object.<anonymous> (/usr/app/node_modules/segfault-handler/index.js:3:37)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)

I searched a bit and found this issue: nodejs/node-report#86 that seems to deal with a similar problem. I don't have a big understanding of what's going on linux wise here, do you think it could be the same problem?

Incomplete stack on Windows

When tracking down a segfault, I got a stack trace that only appears to be the callback, and not the faulting stack:

PID 7492 received SIGSEGV for address: 0x13f23b0
SymInit: Symbol-SearchPath: '.;', symOptions: 530, UserName: 'administrator'
OS-Version: 6.1.7601 (Service Pack 1) 0x112-0x3
6C8228EC (segfault-handler): (filename not available): (function-name not available)
6C821617 (segfault-handler): (filename not available): (function-name not available)
773C223E (ntdll): (filename not available): RtlGetProcessHeaps
773AB806 (ntdll): (filename not available): RtlCaptureContext
773AB4C6 (ntdll): (filename not available): RtlMoveMemory
77360133 (ntdll): (filename not available): KiUserExceptionDispatcher

Any ideas why I can't see the offending stack?

Documentation fault

The documentation says:
var SegfaultHandler = require('segfault_handler');
when it should have a hyphen not an underscore:
var SegfaultHandler = require('segfault-handler');

Build and test with Travis CI?

Any interest in getting a build for node-segfault-handler put into Travis CI? In particular, it could be interesting for testing Node 4 as well as doing some kind of integration testing on OS X. If there is, I'll work on a pull request.

node6 runtime error

Getting the below error at runtime for the below use under node 6. Could not duplicate in an isolated test. Anyone seeing something similar?

Usage:

var SegfaultHandler = require('segfault-handler');
SegfaultHandler.registerHandler();

Runtime error:

"Error: Module did not self-register.
    at Error (native)
    at Object.Module._extensions..node (module.js:568:18)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at bindings (/Users/lmeyerov/Desktop/work4/viz-server/node_modules/graph-viz/node_modules/common/node_modules/segfault-handler/node_modules/bindings/bindings.js:76:44)
    at Object.<anonymous> (/Users/lmeyerov/Desktop/work4/viz-server/node_modules/graph-viz/node_modules/common/node_modules/segfault-handler/index.js:3:37)

will any even better stack dumping?

here is what I get, it doesn't help to find where is the bug.... painfully life...

sometime:

PID 8 received SIGSEGV for address: 0x1fc62c0^M
/sptrader_api_server/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x1b60)[0x7f2978c67b60]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f297e525390]
node[0x1fc62c0]
pure virtual method called
terminate called without an active exception

sometime just:

PID 8 received SIGSEGV for address: 0x1fc62c0
/sptrader_api_server/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x1b60)[0x7f0c67dc2b60]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f0c6d680390]
node[0x1fc62c0]

Gyp Error

Below is the error I'm getting in segfault-handler. My node version is v0.10.25.

npm http 304 https://registry.npmjs.org/nan

[email protected] install /home/kaushik/gitRepo/scxml/node_modules/segfault-handler
node-gyp rebuild

gyp http GET https://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz
gyp http 200 https://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz
gyp http GET https://nodejs.org/dist/v0.10.25/SHASUMS256.txt
gyp http 200 https://nodejs.org/dist/v0.10.25/SHASUMS256.txt
make: Entering directory /home/kaushik/gitRepo/scxml/node_modules/segfault-handler/build' CXX(target) Release/obj.target/segfault-handler/src/segfault-handler.o ../src/segfault-handler.cpp:61:30: error: ‘CopyablePersistentTraits’ is not a member of ‘v8’ v8::Persistent<Function, v8::CopyablePersistentTraits<Function> >* callback; ^ ../src/segfault-handler.cpp:61:30: note: suggested alternatives: In file included from ../node_modules/nan/nan.h:313:0, from ../src/segfault-handler.cpp:2: ../node_modules/nan/nan_persistent_pre_12_inl.h:129:8: note: ‘Nan::CopyablePersistentTraits’ struct CopyablePersistentTraits { ^ ../node_modules/nan/nan_persistent_pre_12_inl.h:129:8: note: ‘Nan::CopyablePersistentTraits’ ../src/segfault-handler.cpp:61:30: error: ‘CopyablePersistentTraits’ is not a member of ‘v8’ v8::Persistent<Function, v8::CopyablePersistentTraits<Function> >* callback; ^ ../src/segfault-handler.cpp:61:30: note: suggested alternatives: In file included from ../node_modules/nan/nan.h:313:0, from ../src/segfault-handler.cpp:2: ../node_modules/nan/nan_persistent_pre_12_inl.h:129:8: note: ‘Nan::CopyablePersistentTraits’ struct CopyablePersistentTraits { ^ ../node_modules/nan/nan_persistent_pre_12_inl.h:129:8: note: ‘Nan::CopyablePersistentTraits’ ../src/segfault-handler.cpp:61:67: error: wrong number of template arguments (2, should be 1) v8::Persistent<Function, v8::CopyablePersistentTraits<Function> >* callback; ^ In file included from /home/kaushik/.node-gyp/0.10.25/src/node.h:62:0, from ../node_modules/nan/nan.h:47, from ../src/segfault-handler.cpp:2: /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:107:26: error: provided for ‘template<class T> class v8::Persistent’ template <class T> class Persistent; ^ ../src/segfault-handler.cpp:61:69: error: expected unqualified-id before ‘>’ token v8::Persistent<Function, v8::CopyablePersistentTraits<Function> >* callback; ^ ../src/segfault-handler.cpp:69:44: error: ‘CopyablePersistentTraits’ is not a member of ‘v8’ callback_args(v8::Persistent<Function, v8::CopyablePersistentTraits<Function> >* callback, void * const* stack, size_t stack_size, int signo, long addr) : ^ ../src/segfault-handler.cpp:69:44: note: suggested alternatives: In file included from ../node_modules/nan/nan.h:313:0, from ../src/segfault-handler.cpp:2: ../node_modules/nan/nan_persistent_pre_12_inl.h:129:8: note: ‘Nan::CopyablePersistentTraits’ struct CopyablePersistentTraits { ^ ../node_modules/nan/nan_persistent_pre_12_inl.h:129:8: note: ‘Nan::CopyablePersistentTraits’ ../src/segfault-handler.cpp:69:44: error: ‘CopyablePersistentTraits’ is not a member of ‘v8’ callback_args(v8::Persistent<Function, v8::CopyablePersistentTraits<Function> >* callback, void * const* stack, size_t stack_size, int signo, long addr) : ^ ../src/segfault-handler.cpp:69:44: note: suggested alternatives: In file included from ../node_modules/nan/nan.h:313:0, from ../src/segfault-handler.cpp:2: ../node_modules/nan/nan_persistent_pre_12_inl.h:129:8: note: ‘Nan::CopyablePersistentTraits’ struct CopyablePersistentTraits { ^ ../node_modules/nan/nan_persistent_pre_12_inl.h:129:8: note: ‘Nan::CopyablePersistentTraits’ ../src/segfault-handler.cpp:69:81: error: wrong number of template arguments (2, should be 1) callback_args(v8::Persistent<Function, v8::CopyablePersistentTraits<Function> >* callback, void * const* stack, size_t stack_size, int signo, long addr) : ^ In file included from /home/kaushik/.node-gyp/0.10.25/src/node.h:62:0, from ../node_modules/nan/nan.h:47, from ../src/segfault-handler.cpp:2: /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:107:26: error: provided for ‘template<class T> class v8::Persistent’ template <class T> class Persistent; ^ ../src/segfault-handler.cpp:69:83: error: expected ‘,’ or ‘...’ before ‘>’ token callback_args(v8::Persistent<Function, v8::CopyablePersistentTraits<Function> >* callback, void * const* stack, size_t stack_size, int signo, long addr) : ^ ../src/segfault-handler.cpp:83:28: error: ‘CopyablePersistentTraits’ is not a member of ‘v8’ v8::Persistent<Function, v8::CopyablePersistentTraits<Function> > callback; ^ ../src/segfault-handler.cpp:83:28: note: suggested alternatives: In file included from ../node_modules/nan/nan.h:313:0, from ../src/segfault-handler.cpp:2: ../node_modules/nan/nan_persistent_pre_12_inl.h:129:8: note: ‘Nan::CopyablePersistentTraits’ struct CopyablePersistentTraits { ^ ../node_modules/nan/nan_persistent_pre_12_inl.h:129:8: note: ‘Nan::CopyablePersistentTraits’ ../src/segfault-handler.cpp:83:28: error: ‘CopyablePersistentTraits’ is not a member of ‘v8’ v8::Persistent<Function, v8::CopyablePersistentTraits<Function> > callback; ^ ../src/segfault-handler.cpp:83:28: note: suggested alternatives: In file included from ../node_modules/nan/nan.h:313:0, from ../src/segfault-handler.cpp:2: ../node_modules/nan/nan_persistent_pre_12_inl.h:129:8: note: ‘Nan::CopyablePersistentTraits’ struct CopyablePersistentTraits { ^ ../node_modules/nan/nan_persistent_pre_12_inl.h:129:8: note: ‘Nan::CopyablePersistentTraits’ ../src/segfault-handler.cpp:83:65: error: wrong number of template arguments (2, should be 1) v8::Persistent<Function, v8::CopyablePersistentTraits<Function> > callback; ^ In file included from /home/kaushik/.node-gyp/0.10.25/src/node.h:62:0, from ../node_modules/nan/nan.h:47, from ../src/segfault-handler.cpp:2: /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:107:26: error: provided for ‘template<class T> class v8::Persistent’ template <class T> class Persistent; ^ ../src/segfault-handler.cpp:83:67: error: expected unqualified-id before ‘>’ token v8::Persistent<Function, v8::CopyablePersistentTraits<Function> > callback; ^ ../src/segfault-handler.cpp: In constructor ‘callback_helper::callback_args::callback_args(int)’: ../src/segfault-handler.cpp:70:5: error: class ‘callback_helper::callback_args’ does not have any field named ‘callback’ callback(callback), stack(backtrace_symbols(stack, stack_size)), stack_size(stack_size), signo(signo), addr(addr) { ^ ../src/segfault-handler.cpp:70:14: error: ‘callback’ was not declared in this scope callback(callback), stack(backtrace_symbols(stack, stack_size)), stack_size(stack_size), signo(signo), addr(addr) { ^ ../src/segfault-handler.cpp:70:66: error: invalid conversion from ‘char**’ to ‘void* const*’ [-fpermissive] callback(callback), stack(backtrace_symbols(stack, stack_size)), stack_size(stack_size), signo(signo), addr(addr) { ^ In file included from ../src/segfault-handler.cpp:22:0: /usr/include/execinfo.h:32:15: error: initializing argument 1 of ‘char** backtrace_symbols(void* const*, int)’ [-fpermissive] extern char **backtrace_symbols (void *const *__array, int __size) ^ ../src/segfault-handler.cpp:69:5: warning: ‘callback_helper::callback_args::stack_size’ is initialized with itself [-Winit-self] callback_args(v8::Persistent<Function, v8::CopyablePersistentTraits<Function> >* callback, void * const* stack, size_t stack_size, int signo, long addr) : ^ ../src/segfault-handler.cpp:69:5: warning: ‘callback_helper::callback_args::signo’ is initialized with itself [-Winit-self] ../src/segfault-handler.cpp:69:5: warning: ‘callback_helper::callback_args::addr’ is initialized with itself [-Winit-self] ../src/segfault-handler.cpp: In constructor ‘callback_helper::callback_helper(v8::Handle<v8::Function>)’: ../src/segfault-handler.cpp:88:5: error: ‘callback’ was not declared in this scope callback.Reset(isolate, func); ^ ../src/segfault-handler.cpp:94:59: error: invalid conversion from ‘void (*)(uv_async_t*) {aka void (*)(uv_async_s*)}’ to ‘uv_async_cb {aka void (*)(uv_async_s*, int)}’ [-fpermissive] uv_async_init(uv_default_loop(), handle, make_callback); ^ In file included from ../node_modules/nan/nan.h:46:0, from ../src/segfault-handler.cpp:2: /home/kaushik/.node-gyp/0.10.25/deps/uv/include/uv.h:1186:15: error: initializing argument 3 of ‘int uv_async_init(uv_loop_t*, uv_async_t*, uv_async_cb)’ [-fpermissive] UV_EXTERN int uv_async_init(uv_loop_t*, uv_async_t* async, ^ ../src/segfault-handler.cpp: In destructor ‘callback_helper::~callback_helper()’: ../src/segfault-handler.cpp:99:5: error: ‘callback’ was not declared in this scope callback.Reset(); ^ ../src/segfault-handler.cpp: In member function ‘void callback_helper::send(void* const*, size_t, int, long int)’: ../src/segfault-handler.cpp:107:46: error: ‘callback’ was not declared in this scope callback_args* args = new callback_args(&callback, stack, stack_size, signo, addr); ^ ../src/segfault-handler.cpp: In static member function ‘static void callback_helper::make_callback(uv_async_t*)’: ../src/segfault-handler.cpp:141:34: error: no matching function for call to ‘v8::HandleScope::HandleScope(v8::Isolate*&)’ v8::HandleScope scope(isolate); ^ ../src/segfault-handler.cpp:141:34: note: candidates are: In file included from /home/kaushik/.node-gyp/0.10.25/src/node.h:62:0, from ../node_modules/nan/nan.h:47, from ../src/segfault-handler.cpp:2: /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:473:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&) HandleScope(const HandleScope&); ^ /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:473:3: note: no known conversion for argument 1 from ‘v8::Isolate*’ to ‘const v8::HandleScope&’ /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:448:3: note: v8::HandleScope::HandleScope() HandleScope(); ^ /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:448:3: note: candidate expects 0 arguments, 1 provided ../src/segfault-handler.cpp:149:65: error: no matching function for call to ‘v8::Array::New(v8::Isolate*&, size_t&)’ Local<Array> argStack = Array::New(isolate, args->stack_size); ^ ../src/segfault-handler.cpp:149:65: note: candidate is: In file included from /home/kaushik/.node-gyp/0.10.25/src/node.h:62:0, from ../node_modules/nan/nan.h:47, from ../src/segfault-handler.cpp:2: /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:1758:32: note: static v8::Local<v8::Array> v8::Array::New(int) V8EXPORT static Local<Array> New(int length = 0); ^ /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:1758:32: note: candidate expects 1 argument, 2 provided ../src/segfault-handler.cpp:151:24: error: ‘NewFromUtf8’ is not a member of ‘v8::String’ argStack->Set(i, String::NewFromUtf8(isolate, args->stack[i])); ^ ../src/segfault-handler.cpp:155:61: error: no matching function for call to ‘v8::Number::New(v8::Isolate*&, int&)’ Local<Value> argv[3] = {Number::New(isolate, args->signo), Number::New(isolate, args->addr), argStack}; ^ ../src/segfault-handler.cpp:155:61: note: candidate is: In file included from /home/kaushik/.node-gyp/0.10.25/src/node.h:62:0, from ../node_modules/nan/nan.h:47, from ../src/segfault-handler.cpp:2: /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:1377:33: note: static v8::Local<v8::Number> v8::Number::New(double) V8EXPORT static Local<Number> New(double value); ^ /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:1377:33: note: candidate expects 1 argument, 2 provided ../src/segfault-handler.cpp:155:95: error: no matching function for call to ‘v8::Number::New(v8::Isolate*&, long int&)’ Local<Value> argv[3] = {Number::New(isolate, args->signo), Number::New(isolate, args->addr), argStack}; ^ ../src/segfault-handler.cpp:155:95: note: candidate is: In file included from /home/kaushik/.node-gyp/0.10.25/src/node.h:62:0, from ../node_modules/nan/nan.h:47, from ../src/segfault-handler.cpp:2: /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:1377:33: note: static v8::Local<v8::Number> v8::Number::New(double) V8EXPORT static Local<Number> New(double value); ^ /home/kaushik/.node-gyp/0.10.25/deps/v8/include/v8.h:1377:33: note: candidate expects 1 argument, 2 provided ../src/segfault-handler.cpp:158:42: error: ‘struct callback_helper::callback_args’ has no member named ‘callback’ Local<Function>::New(isolate, *args->callback)->Call(isolate->GetCurrentContext()->Global(), 3, argv); ^ ../src/segfault-handler.cpp:158:67: error: ‘class v8::Isolate’ has no member named ‘GetCurrentContext’ Local<Function>::New(isolate, *args->callback)->Call(isolate->GetCurrentContext()->Global(), 3, argv); ^ make: *** [Release/obj.target/segfault-handler/src/segfault-handler.o] Error 1 make: Leaving directory/home/kaushik/gitRepo/scxml/node_modules/segfault-handler/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.13.0-32-generic
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/kaushik/gitRepo/scxml/node_modules/segfault-handler
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! weird error 1
npm ERR! not ok code 0

registerHandler is not a function in Ubuntu 14.04 LTS

The binary segfault-handler.node is not building correctly on my ubuntu 14.04, it's showing the zmq API instead of registerHandler/causeSegfault

cat /etc/lsb-release

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"

node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/segfault-handler/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.node-gyp/nsolid-8.4.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/nsolid-8.4.0',
gyp info spawn args   '-Dnode_gyp_dir=/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.node-gyp/nsolid-8.4.0/<(target_arch)/nsolid.lib',
gyp info spawn args   '-Dmodule_root_dir=/tmp/segfault-handler',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/tmp/segfault-handler/build'
  CXX(target) Release/obj.target/segfault-handler/src/segfault-handler.o
  SOLINK_MODULE(target) Release/obj.target/segfault-handler.node
  COPY Release/segfault-handler.node
make: Leaving directory `/tmp/segfault-handler/build'
gyp info ok

node -e "require('./build/Release/segfault-handler.node').registerHandler('test')"

require('./build/Release/segfault-handler.node').registerHandler('test')
                                                 ^
TypeError: require(...).registerHandler is not a function
    at [eval]:1:50
    at ContextifyScript.Script.runInThisContext (vm.js:44:33)
    at Object.runInThisContext (vm.js:116:38)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:625:30)
    at evalScript (bootstrap_node.js:486:27)
    at startup (bootstrap_node.js:171:9)
    at bootstrap_node.js:632:3

node -e "console.log(require('./build/Release/segfault-handler.node'))"

{ ZMQ_CAN_DISCONNECT: 1,
  ZMQ_CAN_UNBIND: 1,
  ZMQ_CAN_MONITOR: 1,
  ZMQ_CAN_SET_CTX: 1,
  ZMQ_PUB: 1,
  ZMQ_SUB: 2,
  ZMQ_XPUB: 9,
  ZMQ_XSUB: 10,
  ZMQ_REQ: 3,
  ZMQ_XREQ: 5,
  ZMQ_REP: 4,
  ZMQ_XREP: 6,
  ZMQ_DEALER: 5,
  ZMQ_ROUTER: 6,
  ZMQ_PUSH: 8,
  ZMQ_PULL: 7,
  ZMQ_PAIR: 0,
  ZMQ_STREAM: 11,
  ZMQ_POLLIN: 1,
  ZMQ_POLLOUT: 2,
  ZMQ_POLLERR: 4,
  ZMQ_SNDMORE: 2,
  STATE_READY: 0,
  STATE_BUSY: 1,
  STATE_CLOSED: 2,
  zmqVersion: [Function: zmqVersion],
  zmqCurveKeypair: [Function: zmqCurveKeypair],
  Context: [Function],
  SocketBinding: [Function] }

The same happens building using npm install segfault-handler

Windows: segfault in `RtlGetLengthWithoutLastFullDosOrNtPathElement` seemingly innocuous, but gets trapped anyways

Key Value
Edition Windows 11 Pro
Version 22H2
OS build 22621.1992
Experience Windows Feature Experience Pack 1000.22644.1000.0
Processor 12th Gen Intel(R) Core(TM) i7-12800H 2.40 GHz
Installed RAM 64.0 GB (63.7 GB usable)
System type 64-bit operating system, x64-based processor

I've recently updated Windows and suddenly there are a ton of segfaults inside this ntdll function. I believe segfaults are innocuous because:

  • They do not occur or are handled seamlessly when running inside a debugger (Visual Studio, WinDbg)
  • Not enabling this library allows the application to run smoothly
  • A compliant call to a function like OutputDebugStringA triggers it

However, with this library loaded into the process, the application cannot run because of all the segfaults it detects.

I am not confident this library is still maintained, so I have not provided a minimal reproducible example for the sake of debugging, and am mostly just posting this issue so that search engines pick it up. However, if someone is interested in fixing this, I would be happy to provide such an example.

Out of the box build failure -- `'v8-debug.h' file not found`

Install Output:

$ npm install segfault

> [email protected] install /Users/bjenks/Desktop/foo/node_modules/segfault
> node-gyp rebuild

  CXX(target) Release/obj.target/segfault-handler/src/segfault-handler.o
../src/segfault-handler.cpp:15:10: fatal error: 'v8-debug.h' file not found
#include <v8-debug.h>
         ^~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/segfault-handler/src/segfault-handler.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/usr/local/Cellar/node/12.12.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/bjenks/Desktop/foo/node_modules/segfault
gyp ERR! node -v v12.12.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok

Versions:

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15.2
BuildVersion:	19C57
$ node --version
v12.12.0
$ npm --version
6.13.2

Seems like v8-debug.h doesn't ship with node or node-gyp anymore?

$ ls /usr/local/Cellar/node/12.12.0/include/node/
common.gypi			v8-internal.h
config.gypi			v8-platform.h
js_native_api.h			v8-profiler.h
js_native_api_types.h		v8-testing.h
libplatform			v8-util.h
node.h				v8-value-serializer-version.h
node_api.h			v8-version-string.h
node_api_types.h		v8-version.h
node_buffer.h			v8-wasm-trap-handler-posix.h
node_object_wrap.h		v8-wasm-trap-handler-win.h
node_version.h			v8.h
openssl				v8config.h
uv				zconf.h
uv.h				zlib.h
$ ls ~/Library/Caches/node-gyp/12.12.0/include/node/
common.gypi			v8-internal.h
config.gypi			v8-platform.h
js_native_api.h			v8-profiler.h
js_native_api_types.h		v8-testing.h
libplatform			v8-util.h
node.h				v8-value-serializer-version.h
node_api.h			v8-version-string.h
node_api_types.h		v8-version.h
node_buffer.h			v8-wasm-trap-handler-posix.h
node_object_wrap.h		v8-wasm-trap-handler-win.h
node_version.h			v8.h
openssl				v8config.h
uv				zconf.h
uv.h				zlib.h

Missing "execinfo.h" on Node Alpine

Hi,

I've got an issue running an NPM install with this module in Docker (node-alpine):

FROM node:12.15.0-alpine

The issue:

> [email protected] install /opt/hades/node_modules/segfault-handler
> node-gyp rebuild

make: Entering directory '/opt/hades/node_modules/segfault-handler/build'
  CXX(target) Release/obj.target/segfault-handler/src/segfault-handler.o
../src/segfault-handler.cpp:23:10: fatal error: execinfo.h: No such file or directory
   23 | #include <execinfo.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make: Leaving directory '/opt/hades/node_modules/segfault-handler/build'
make: *** [segfault-handler.target.mk:113: Release/obj.target/segfault-handler/src/segfault-handler.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.19.76-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/hades/node_modules/segfault-handler
gyp ERR! node -v v12.15.0
gyp ERR! node-gyp -v v5.0.5

I tried the fix found there:
nodejs/node-report#86 (comment)

RUN echo "@edge http://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
RUN apk update
RUN apk add libexecinfo-dev@edge

I got a lot of red warnings like:
warning: cast between incompatible function types from 'void

But the install go through and the docker image is built successfully.

However it is still not working, it seems it doesn't find the backtrace tool when a SIGSEGV signal happens:

/opt/hades/node_modules/bindings/bindings.js:121
        throw e;
        ^

Error: Error relocating /opt/hades/node_modules/segfault-handler/build/Release/segfault-handler.node: backtrace: symbol not found
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1021:18)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at bindings (/opt/hades/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/opt/hades/node_modules/segfault-handler/index.js:3:37)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)

Any clue?

Please clean build output [cosmetic]

On debian buster 32-bit with node 9.11.2 and npm 5.6.0 we get following output:

> [email protected] install /home/user/src/node-segfault-handler
> node-gyp rebuild

make: Entering directory '/home/user/src/node-segfault-handler/build'
  CXX(target) Release/obj.target/segfault-handler/src/segfault-handler.o
In file included from /home/user/.node-gyp/9.11.2/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/segfault-handler.cpp:2:
/home/user/.node-gyp/9.11.2/include/node/v8.h: In static member function ‘static void v8::V8::RemoveGCPrologueCallback(v8::GCCallback)’:
/home/user/.node-gyp/9.11.2/include/node/v8.h:10378:53: warning: cast between incompatible function types from ‘v8::GCCallback’ {aka ‘void (*)(v8::GCType, v8::GCCallbackFlags)’} to ‘v8::Isolate::GCCallback’ {aka ‘void (*)(v8::Isolate*, v8::GCType, v8::GCCallbackFlags)’} [-Wcast-function-type]
       reinterpret_cast<Isolate::GCCallback>(callback));
                                                     ^
/home/user/.node-gyp/9.11.2/include/node/v8.h: In static member function ‘static void v8::V8::RemoveGCEpilogueCallback(v8::GCCallback)’:
/home/user/.node-gyp/9.11.2/include/node/v8.h:10385:53: warning: cast between incompatible function types from ‘v8::GCCallback’ {aka ‘void (*)(v8::GCType, v8::GCCallbackFlags)’} to ‘v8::Isolate::GCCallback’ {aka ‘void (*)(v8::Isolate*, v8::GCType, v8::GCCallbackFlags)’} [-Wcast-function-type]
       reinterpret_cast<Isolate::GCCallback>(callback));
                                                     ^
In file included from ../src/segfault-handler.cpp:2:
../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../node_modules/nan/nan.h:2208:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
In file included from ../node_modules/nan/nan.h:52,
                 from ../src/segfault-handler.cpp:2:
../src/segfault-handler.cpp: At global scope:
/home/user/.node-gyp/9.11.2/include/node/node.h:505:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/home/user/.node-gyp/9.11.2/include/node/node.h:539:3: note: in expansion of macro ‘NODE_MODULE_X’
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/segfault-handler.cpp:339:3: note: in expansion of macro ‘NODE_MODULE’
   NODE_MODULE(segfault_handler, init)
   ^~~~~~~~~~~
In file included from /home/user/.node-gyp/9.11.2/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/segfault-handler.cpp:2:
/home/user/.node-gyp/9.11.2/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/user/.node-gyp/9.11.2/include/node/node_object_wrap.h:85:78:   required from here
/home/user/.node-gyp/9.11.2/include/node/v8.h:9338:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/.node-gyp/9.11.2/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../node_modules/nan/nan_object_wrap.h:66:61:   required from here
/home/user/.node-gyp/9.11.2/include/node/v8.h:9338:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  SOLINK_MODULE(target) Release/obj.target/segfault-handler.node
  COPY Release/segfault-handler.node
make: Leaving directory '/home/user/src/node-segfault-handler/build'
up to date in 5.098s

This may not be serious but clutters the build log of our project.

Fails to build under Node 12

error /tmp/test/node_modules/segfault-handler: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /tmp/test/node_modules/segfault-handler
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [
gyp info spawn args   '/home/stefan/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/test/node_modules/segfault-handler/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/stefan/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/stefan/.node-gyp/12.2.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/stefan/.node-gyp/12.2.0',
gyp info spawn args   '-Dnode_gyp_dir=/home/stefan/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/stefan/.node-gyp/12.2.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/tmp/test/node_modules/segfault-handler',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build', '--jobs', 14 ]
make: Entering directory '/tmp/test/node_modules/segfault-handler/build'
  CXX(target) Release/obj.target/segfault-handler/src/segfault-handler.o
../src/segfault-handler.cpp:86:25: error: expected ‘)’ before ‘<’ token
   callback_helper(Handle<Function> func) {
                         ^
../src/segfault-handler.cpp: In static member function ‘static void callback_helper::make_callback(uv_async_t*)’:
../src/segfault-handler.cpp:152:67: warning: ‘static v8::Local<v8::String> v8::String::NewFromUtf8(v8::Isolate*, const char*, v8::String::NewStringType, int)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       argStack->Set(i, String::NewFromUtf8(isolate, args->stack[i]));
                                                                   ^
In file included from /home/stefan/.node-gyp/12.2.0/include/node/v8-internal.h:14:0,
                 from /home/stefan/.node-gyp/12.2.0/include/node/v8.h:25,
                 from /home/stefan/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/segfault-handler.cpp:2:
/home/stefan/.node-gyp/12.2.0/include/node/v8.h:2892:21: note: declared here
       Local<String> NewFromUtf8(Isolate* isolate, const char* data,
                     ^
/home/stefan/.node-gyp/12.2.0/include/node/v8config.h:307:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/segfault-handler.cpp:152:68: warning: ‘bool v8::Object::Set(uint32_t, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       argStack->Set(i, String::NewFromUtf8(isolate, args->stack[i]));
                                                                    ^
In file included from /home/stefan/.node-gyp/12.2.0/include/node/v8-internal.h:14:0,
                 from /home/stefan/.node-gyp/12.2.0/include/node/v8.h:25,
                 from /home/stefan/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/segfault-handler.cpp:2:
/home/stefan/.node-gyp/12.2.0/include/node/v8.h:3368:26: note: declared here
                     bool Set(uint32_t index, Local<Value> value));
                          ^
/home/stefan/.node-gyp/12.2.0/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/segfault-handler.cpp:159:105: error: no matching function for call to ‘v8::Function::Call(v8::Local<v8::Object>, int, v8::Local<v8::Value> [3])’
     Local<Function>::New(isolate, *args->callback)->Call(isolate->GetCurrentContext()->Global(), 3, argv);
                                                                                                         ^
In file included from /home/stefan/.node-gyp/12.2.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:53,
                 from ../src/segfault-handler.cpp:2:
/home/stefan/.node-gyp/12.2.0/include/node/v8.h:4148:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*)
   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Call(Local<Context> context,
                                           ^~~~
/home/stefan/.node-gyp/12.2.0/include/node/v8.h:4148:43: note:   candidate expects 4 arguments, 3 provided
../src/segfault-handler.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE RegisterHandler(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/segfault-handler.cpp:314:40: error: ‘Handle’ was not declared in this scope
         callback = new callback_helper(Handle<Function>::Cast(info[i]));
                                        ^~~~~~
../src/segfault-handler.cpp:314:40: note: suggested alternative: ‘rand_r’
         callback = new callback_helper(Handle<Function>::Cast(info[i]));
                                        ^~~~~~
                                        rand_r
../src/segfault-handler.cpp:314:55: error: expected primary-expression before ‘>’ token
         callback = new callback_helper(Handle<Function>::Cast(info[i]));
                                                       ^
../src/segfault-handler.cpp:314:58: error: ‘::Cast’ has not been declared
         callback = new callback_helper(Handle<Function>::Cast(info[i]));
                                                          ^~~~
make: *** [segfault-handler.target.mk:111: Release/obj.target/segfault-handler/src/segfault-handler.o] Error 1
make: Leaving directory '/tmp/test/node_modules/segfault-handler/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/stefan/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:257:12)
gyp ERR! System Linux 5.0.0-13-generic
gyp ERR! command "/home/stefan/.nvm/versions/node/v12.2.0/bin/node" "/home/stefan/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/test/node_modules/segfault-handler
gyp ERR! node -v v12.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

0.2.4 fails to build with [email protected]

Seeing this build error with [email protected]:

% npm install segfault-handler
\
> [email protected] install /home/bclark/tmp/node_modules/segfault-handler
> node-gyp rebuild


module.js:340
    throw err;
          ^
Error: Cannot find module 'nan'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at [eval]:1:1
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:456:26)
    at evalScript (node.js:536:25)
    at startup (node.js:80:7)
    at node.js:906:3
gyp: Call to 'node -e "require('nan')"' returned exit status 8. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Linux 3.13.0-43-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/bclark/tmp/node_modules/segfault-handler
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the segfault-handler package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls segfault-handler
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-43-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "segfault-handler"
npm ERR! cwd /home/bclark/tmp
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

installation error osx

>sw_vers
ProductName:    Mac OS X
ProductVersion: 10.10.5
BuildVersion:   14F27
>node -v
v4.0.0
>npm -v
2.14.2
> npm install segfault-handler

npm WARN package.json @ No description
npm WARN package.json @ No repository field.
npm WARN package.json @ No README data
npm WARN package.json @ No license field.
\
> [email protected] install /devel/source/xxxxx/apps/services/test/api/node_modules/segfault-handler
> node-gyp rebuild

gyp: /Users/xxxxx/.node-gyp/4.0.0/common.gypi not found (cwd: /devel/source/xxxxx/apps/services/test/api/node_modules/segfault-handler) while reading includes of binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/Cellar/nvm/0.26.1/versions/node/v4.0.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:357:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/Cellar/nvm/0.26.1/versions/node/v4.0.0/bin/node" "/usr/local/Cellar/nvm/0.26.1/versions/node/v4.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /devel/source/xxxxx/apps/services/test/api/node_modules/segfault-handler
gyp ERR! node -v v4.0.0
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/nvm/0.26.1/versions/node/v4.0.0/bin/node" "/usr/local/opt/nvm/versions/node/v4.0.0/bin/npm" "install" "segfault-handler"
npm ERR! node v4.0.0
npm ERR! npm  v2.14.2
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the segfault-handler package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls segfault-handler
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /devel/source/xxxxxx/apps/services/test/api/npm-debug.log

poking around ~/.node-gyp/4.0.0/common.gypi is now ~/.node-gyp/4.0.0/include/node/common.gypi

Segmentation fault Error

  • Node.js Version: 15.8.0
  • OS: linux - debian
  • Scope: runtime

i am getting this error Segmentation fault i don't know why or where

PID 22564 received SIGSEGV for address: 0xffffffff
/root/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x2cc1)[0x7f7c345f1cc1]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x110e0)[0x7f7c35ba60e0]
node[0xa1c7fe]
node[0xcaedfb]
node[0xcb03ac]
node(_ZN2v88internal21Builtin_HandleApiCallEiPmPNS0_7IsolateE+0x16)[0xcb0a26]
node[0x14cfc59]

-->

npm version doesn't include PR #5

I had the issue fixed by PR #5 when I installed via npm install segfault-handler. Installing from git worked (npm install git://github.com/ddopson/node-segfault-handler.git)

I would guess that bumping the version number and pushing will fix the problem.

Possible to unregister at runtime?

First of all, fantastic module. Thank you!

Is it possible to unregister the handler at runtime? Sometimes I need to force a server shutdown abruptly (not cleanly) and the handler gets tickled... I would like to be able to disable it before I do so.

Should this be built-in behavior of node.js?

It seems like printing "seg fault" and dying is a pretty bad way for node to behave. I'm wondering if the behavior in this module should be merged into the main node.js project? Has that been suggested or discussed before?

Side effects on native dependencies on Windows

Havent got time to inspect really but this was quite annoying. After installing and including module. Scripts with native dependencies started not responding. Also some regular npm modules went missing.

Even after rebuilding and reinstalling Node, this effect continues. Any assumption would be appreciated. How come some package can be installed with npm but not rebuilding or not uninstalling with npm?

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.