Reputation: 32945
In a complex JavaScript app (with jQuery and Ember), the JavaScript will occasionally crash randomly, either during page load or when I perform an action on the page. The error is as follows (screenshot):
Uncaught RangeError: Maximum call stack size exceeded
Class.proto
Class.proto
...
... with several pages of Class.proto
stack trace lines, but no source/line information whatsoever, even at the bottom of the trace.
I know that this points at infinite recursion, and this could conceivably happen in the event system, but there is no obvious starting point for me.
I've been able to reproduce this only in Chrome Canary (22.0.1209.0), not Chrome stable or Firefox. The app is not talking to any external service or making any Ajax requests.
Since it happens only occasionally, and with no discernible cause, and since there's no usable stack trace, I'm having trouble tracking down the cause.
My question: What can I do to debug this problem?
Upvotes: 37
Views: 21245
Reputation: 619
Some browsers no longer have breakpoints for uncaught Maximum call stack size exceeded
errors.
Thanks to @Split Your Infinity and others on the Chromium bug report, there is a decent debugging strategy for Chrome:
Error.stackTraceLimit = Infinity
Documented here: https://v8.dev/docs/stack-trace-api
Upvotes: 2
Reputation: 4229
Enable 'Break on exceptions' in the Chrome Developer Toolbar. Use this icon in the footer of the toolbar on the Sources tab (there are 3 states!)
It should stop your code and you can see the stack!
Upvotes: 24