Repository navigation
recursion error not reported #14311
Description
Activity
- addedquestionIssues asking questions about Node.js.Issues asking questions about Node.js.
on Jul 16, 2017 Without
console.log()call the error message is printed (with or withoutuncaughtExceptionhandler):RangeError: Maximum call stack size exceeded at recursiveFunction (test.js:8:27) at recursiveFunction (test.js:10:5) at recursiveFunction (test.js:10:5) at recursiveFunction (test.js:10:5) at recursiveFunction (test.js:10:5) at recursiveFunction (test.js:10:5) at recursiveFunction (test.js:10:5) at recursiveFunction (test.js:10:5) at recursiveFunction (test.js:10:5) at recursiveFunction (test.js:10:5)
With redirected stdout and without
uncaughtExceptionhandler:
>test.js > out.logutil.js:597 function formatPrimitive(ctx, value) { ^ RangeError: Maximum call stack size exceeded at formatPrimitive (util.js:597:25) at formatValue (util.js:350:19) at inspect (util.js:196:10) at exports.format (util.js:68:24) at Console.log (console.js:106:24) at recursiveFunction (test.js:9:13) at recursiveFunction (test.js:10:5) at recursiveFunction (test.js:10:5) at recursiveFunction (test.js:10:5) at recursiveFunction (test.js:10:5)
Yes, get the same here.
The code with console.log was to recreate something I'm getting in real code - which it does.
So it appears output - which I have in my real code via process.stdout.write mostly (and console.log in some cases though not called when error manifests ) affects the reporting of the recursion error.- addedwindowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
on Jul 16, 2017 I can reproduce on Windows, not on Linux.
- addedknown limitationIssues that are identified as known limitations.Issues that are identified as known limitations.
on Jul 17, 2017 I'd chalk this up as a known limitation. Since the stack is almost full, there is hardly anything you can do that won't raise another exception.
I have to disagree with you there bnoordhuis ; I'd say the behaviour should be consistent across implementations and scenarios and should report the error as it does on Linux or on Windows without the console.log call. I'd mark this as a bug.
(otherwise you have apps just stopping mid execution for no apparent reason with no way to find the fault bar an educated guess..)
Reacted by jazoom and Antti KorpiI don't think you are hitting an actual stack overflow here, but rather a v8 limit, and it should be possible to report that. It is not like the process itself is out of memory, right?
cc @nodejs/v8
Let me amend: hardly anything you can do in javascript.
See #6899 for a similar bug report. Node.js already tries to do something meaningful on stack overflow but there isn't much wiggle room with a try/catch statement or
process.on('uncaughtException')handler.And for some more (and more recent) discussion: nodejs/node-v8#5
I'm closing this as known limitation per my previous comments. If anyone has ideas on how to handle it better, please open a PR.
App just stops without any error information. Eg.
This will run so far then just stop. Try/Catch didn't work either - tried as above with ;
Again nothing - just stops.
Have workaround ;
but original code should report error when fails.