peerlibrary:segfault-handler

v0.1.4Published 10 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

segfault-handler package

Meteor package for capturing Meteor stack trace on SIGSEGV and SIGBUS signals and receiving a callback when they occur. It is built upon node-segfault-handler node.js package.

Adding this package to your Meteor application adds SegfaultHandler object into the global scope.

You can use SegfaultHandler.registerHandler to register a callback which receives stack, signal, and address arguments. You can use that callback to log the signal or in some other way handle the signal, but you should be careful that code is not too complex. When SIGSEGV or SIGBUS signal is received by your Meteor application it means that it did an illegal memory operation and its state is undefined.

Server side only.

Installation

mrt add segfault-handler

Example

SegfaultHandler.registerHandler (stack, signal, address) ->
  message = "Received SIGSEGV/SIGBUS (#{ signal }) for address 0x#{ address.toString(16) }"
  stack = stack.join '\n'
  Log.error "#{ message }\n#{ stack }"

  Errors.insert
    message: message
    stack: stack