Search code examples
javascriptnode.jssegmentation-faultobjdump

node js script crashes: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)


My script crashes and debugger is unable to catch the error. I even tried to try catch some functions but it didnt work.

Any suggestion how to narrow down where the problem could be?

The script is a testing script for a game. It works good for previous games, but for new game there are some new cases. Unfortunately I cannot know where is the error. Probably when unique case object is received from server.

The script is testing against the server and writing output to either console or file. In both cases error happens.

Error: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

edit:

here is SegfaultHandler output:

PID 2645 received SIGSEGV for address: 0x0 0 segfault-handler.node 0x00000001034ae1c8 _ZL16segfault_handleriP9__siginfoPv + 280 1 libsystem_platform.dylib 0x00007fff9364b52a _sigtramp + 26 2 ??? 0x0000000000000010 0x0 + 16 3 node 0x000000010067bbdc _ZN2v88internal23Runtime_GetFrameDetailsEiPPNS0_6ObjectEPNS0_7IsolateE + 2364 4 ??? 0x00000a107710961b 0x0 + 11065833330203 5 ??? 0x00000a107795c134 0x0 + 11065842057524


Solution

  • The exit code (139) means a segmentation fault occurred (128 + 11 (for segfault)).

    You can use the segfault-handler module to debug the segmentation fault. You can use it like so:

    var SegfaultHandler = require('segfault-handler');
    
    SegfaultHandler.registerHandler("crash.log"); // With no argument, SegfaultHandler will generate a generic log file name
    
    // Write the cause that causes the segmentation fault here
    

    You should see a stack trace that you can now debug using tools like objdump -dS module.node.

    objdump displays information about one or more object files.