is it possible to inspect the javascript stack trace when node.js
goes in Segmentation fault?
The current situation is the following: I am running a script which has a few nested async.eachSeries
, which caused for some weird reason a RangeError: Maximum call stack size exceeded
. Hence, I have increased the stack size via node --stack-size=1000000
and I am left with the Segmentation fault.
Here is the source code of the script: http://nopaste.info/ca0c118591.html
I also tried segfault-handler
, but for some inscrutable reason it is not catching my segfault.
wikipedia.org/wiki/Segmentation_fault. In practice, a segfault occurs when your program breaks some fundamental rule set by the operating system. In that case, the operating system sends your process a signal (SIGSEGV on Mac & Linux, STATUS_ACCESS_VIOLATION on Windows), and typically the process shuts down immediately.
A segmentation fault (aka segfault) is a common condition that causes programs to crash; they are often associated with a file named core . Segfaults are caused by a program trying to read or write an illegal memory location.
SIGSEGV is triggered by the operating system, which detects that a process is carrying out a memory violation, and may terminate it as a result. SIGABRT (signal abort) is a signal triggered by a process itself.
Unfortunately, there are a few cases where you can still hit segfaults in Node: When you use native addons (either directly, or because one of your dependencies uses them), so you're effectively running your own native code as part of your application.
A segmentation fault occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed (for example, attempting to write to a read-only location, or to overwrite part of the operating system).
Use this command to check if you have segmentation faults. If you do, clean the npm cache this way. Then try rebuilding your project. If it doesn't work try to uninstall node completely then put it back. You may need to re-run the steps above after reinstalling node and npm.
There is the segfault-handler
module which catches segfaults on non-Windows platforms and generates a stack trace. But if you're getting a RangeError
, that's not a segfault.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With