javascript 谷歌浏览器:如何调试随机“超出最大调用堆栈大小”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11544321/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 13:36:51  来源:igfitidea点击:

Google Chrome: How to debug random "Maximum call stack size exceeded" errors

javascriptgoogle-chrome

提问by Jo Liss

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):

在复杂的 JavaScript 应用程序(使用 jQuery 和 Ember)中,JavaScript 偶尔会随机崩溃,无论是在页面加载期间还是在我对页面执行操作时。错误如下(截图):

Uncaught RangeError: Maximum call stack size exceeded
  Class.proto
  Class.proto
  ...

... with several pages of Class.protostack trace lines, but no source/line information whatsoever, even at the bottom of the trace.

...有几页Class.proto堆栈跟踪行,但没有任何源/行信息,即使在跟踪的底部也是如此。

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.

只能在 Chrome Canary(22.0.1209.0) 中重现这一点,而不是 Chrome stable 或 Firefox。该应用程序不与任何外部服务交谈或发出任何 Ajax 请求。

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?

我的问题:我能做些什么来调试这个问题?

采纳答案by Split Your Infinity

Enable 'Break on exceptions' in the Chrome Developer Toolbar. Use this This is the iconicon in the footer of the toolbar on the Sourcestab (there are 3 states!)

在 Chrome 开发人员工具栏中启用“中断例外”。这是图标在“源”选项卡上工具栏的页脚中使用此图标(有 3 种状态!)

It should stop your code and you can see the stack!

它应该停止您的代码,您可以看到堆栈!