Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

No stack trace printed nor does process exit. #24

Closed
jspavlick opened this issue Apr 11, 2015 · 8 comments
Closed

No stack trace printed nor does process exit. #24

jspavlick opened this issue Apr 11, 2015 · 8 comments

Comments

@jspavlick
Copy link

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.

@jspavlick
Copy link
Author

Attempts to reproduce the segfault on my laptop (OS X) are proving unsuccessful.

@No9
Copy link
Collaborator

No9 commented Apr 11, 2015

@jspavlick Can you checkout the repo and run the tests?

@jspavlick
Copy link
Author

Thanks for the quick response.

Running example.js on my laptop (OS X) provides a wonderfully nice stack trace.

Laptop:

~> node example.js
NodeSegfaultHandlerNative: about to dereference NULL (will cause a SIGSEGV)
PID 44292 received SIGSEGV for address: 0x1
0   segfault-handler.node               0x00000001008de47a _ZL16segfault_handleriP9__siginfoPv + 282
1   libsystem_platform.dylib            0x00007fff92ddbf1a _sigtramp + 26
2   ???                                 0x00007fff5fbfef10 0x0 + 140734799802128
3   segfault-handler.node               0x00000001008de246 _Z22segfault_stack_frame_2v + 22
4   segfault-handler.node               0x00000001008de276 _Z13CauseSegfaultRKN2v89ArgumentsE + 38
5   node                                0x0000000100145b9a _ZN2v88internalL21Builtin_HandleApiCallENS0_12_GLOBAL__N_116BuiltinArgumentsILNS0_21BuiltinExtraArgumentsE1EEEPNS0_7IsolateE + 459
6   ???                                 0x00002f747c00618e 0x0 + 52177343111566
7   ???                                 0x00002f747c063df3 0x0 + 52177343495667

Heroku:

~> heroku run crash --app my-app
Running `crash` attached to terminal... up, run.6659
Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
Recommending WEB_CONCURRENCY=1
NodeSegfaultHandlerNative: about to dereference NULL (will cause a SIGSEGV)
PID 3 received SIGSEGV for address: 0x1
/app/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x10e5)[0x7f33b06960e5]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f33b0c6d340]
/app/node_modules/segfault-handler/build/Release/segfault-handler.node(_Z22segfault_stack_frame_1v+0x10)[0x7f33b06961d0]
/app/node_modules/segfault-handler/build/Release/segfault-handler.node(_Z13CauseSegfaultRKN2v89ArgumentsE+0x1c)[0x7f33b069620c]
node[0x70fdc7]
[0x25ebbdd06362]
stty: standard input: unable to perform all requested operations

However, I receive no such stack dump when not running the example code.

Thanks.

@jspavlick
Copy link
Author

I was just able to get my laptop node process to segfault. Notice node-segfault-handler did not help me. I'm not sure what to do next.

node(43906,0x7fff7536a300) malloc: *** error for object 0x10298d008: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
/Library/Ruby/Gems/2.0.0/gems/foreman-0.77.0/lib/foreman/cli.rb:103:in `exit': no implicit conversion from nil to integer (TypeError)
    from /Library/Ruby/Gems/2.0.0/gems/foreman-0.77.0/lib/foreman/cli.rb:103:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Library/Ruby/Gems/2.0.0/gems/foreman-0.77.0/bin/foreman:7:in `<top (required)>'
    from /usr/bin/foreman:23:in `load'
    from /usr/bin/foreman:23:in `<main>'

@No9
Copy link
Collaborator

No9 commented Apr 11, 2015

I haven't worked with heroku so you will have to bear with me here
but it looks like heroku are using foreman as the process manager?

So heroku run crash --app my-app
Is really a wrapper around forman

If that's the case can you run the node process directly on the server as you would on your local machine?
If you want a process manager then https://www.npmjs.com/package/forever might help.

Other than that you could ask the forman folks what might be preventing the stacktrace from surfacing up

@No9
Copy link
Collaborator

No9 commented Sep 24, 2015

Hey @jspavlick I am going to close this as it's been around for a while.
If you have more input or further questions please feel free to spin up another issue.

@No9 No9 closed this as completed Sep 24, 2015
@relovution
Copy link
Contributor

I'm having a similar issue, not with not exiting but I have no stack trace:

root@beaglebone:~/test/node_modules/segfault-handler# node example.js 
NodeSegfaultHandlerNative: about to dereference NULL (will cause a SIGSEGV)
PID 1907 received SIGSEGV for address: 0x2
root@beaglebone:~/test/node_modules/segfault-handler# uname -a
Linux beaglebone 4.1.19-bone-rt-r20 #1 Sun Mar 13 04:30:34 UTC 2016 armv7l GNU/Linux

Any ideas?

@relovution
Copy link
Contributor

I found a solution: adding -funwind-tables to CFLAGS in binding.gyp fixes this problem (see http://stackoverflow.com/questions/24700150/on-raspberry-pi-backtrace-returns-0-frames). Test after doing node-gyp rebuild:

root@beaglebone:~/test/node_modules/segfault-handler# node example.js 
NodeSegfaultHandlerNative: about to dereference NULL (will cause a SIGSEGV)
PID 2268 received SIGSEGV for address: 0x2
/root/test/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x12a0)[0xb68ba2a0]
/lib/arm-linux-gnueabihf/libc.so.6(+0x26b00)[0xb68f1b00]
/root/test/node_modules/segfault-handler/build/Release/segfault-handler.node(_Z22segfault_stack_frame_1v+0x1f)[0xb68ba5c4]
/root/test/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x1434)[0xb68ba434]

I can create a pull request, but I haven't tested it on x86/x86_64, any idea if this will have any repercussions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants