Node.js and segmentation error

Is it possible to check the javascript stack trace when node.js goes in a segmentation error?

The current situation is as follows: I am running a script that has several nested async.eachSeries that caused some strange reason a RangeError: Maximum call stack size exceeded . Therefore, I increased the size of the stack with node --stack-size=1000000 , and I was left with a segmentation error.

Here is the source code of the script: http://nopaste.info/ca0c118591.html

Update

I also tried segfault-handler , but for some incomprehensible reason, it did not catch my segfault.

+6
source share
2 answers

There is a segfault-handler module that catches segfaults on non-Windows platforms and creates a stack trace. But if you get a RangeError , this is not a segfault.

+2
source

This probably means that you have recursiveness somewhere in your code. Since V8 has removed TCO support (Tail Call Optimization), the call size will increase until it breaks.

Using --stack_size may seem like a natural solution, but it doesn’t actually increase the stack size, and tells V8 that there is a larger stack size when it is actually controlled by the OS.

Sources:

So now (with Node.js 8.x) the best solution is to simply stop using recursive functions.

0
source

Source: https://habr.com/ru/post/979172/


All Articles