简体   繁体   English

零星的JS Bug追逐:过多的递归

[英]Sporadic JS Bug Chasing: Too Much Recursion

I am hesitant to ask yet another "too much recursion" question, but I'm totally lost for ideas. 我很犹豫地要问另一个“太多递归”的问题,但是我完全迷失了想法。

I am getting a "too much recursion" error during my .ready(), which is unhelpfully occurring: 我的.ready()过程中收到“太多递归”错误,该错误无济于事:

  • Very sporadically (ie once a month) for me 对我来说非常零星(即每月一次)
  • Pretty much every other time I have to do a demo using someone else's computer (of course) 我几乎每隔一次就必须使用他人的计算机进行演示(当然)
  • On FF, Chrome, IE9 etc, on our dev, prod and test systems 在FF,Chrome,IE9等上,在我们的开发,生产和测试系统上

And it's getting trapped deep inside the bowels of jQuery (1.10.2). 而且它被困在jQuery(1.10.2)的内部。 Specifically, at this line of Sizzle , inside Sizzle.attr. 具体来说,在Sizzle.attr中的Sizzle的这一行

I've tried to "force" this bug to appear by using low memory VMs, but that doesn't seem to help. 我试图通过使用内存不足的VM来“强制”该错误出现,但这似乎无济于事。 I'm stumped as to how to find where this is occurring, since I can't get a stack trace. 由于无法获取堆栈跟踪信息,我很困惑如何找到这种情况的发生。 I've got no minimal example either, since I can't make the bug happen. 我也没有最少的示例,因为我无法使该错误发生。

The most likely candidate is something like triggering an event inside its handler, but I can't see how that would occur only sometimes, on load? 最有可能的候选对象是诸如在其处理程序中触发事件之类的东西,但是我看不到这种情况仅在加载时才会发生?

How can I try and find what is happening? 我如何尝试查找正在发生的事情?

Any help or tips or links most welcome. 最欢迎任何帮助或提示或链接。 If it's useful, I'm using jQuery, jQuery UI, and OpenLayers. 如果有用,我正在使用jQuery,jQuery UI和OpenLayers。

Try looking at a JS stacktrace when it errors to see the call chain - for a recursion problem this should show you what's recursing. 尝试在出现错误时查看JS stacktrace以查看调用链-对于递归问题,这应该向您显示递归的内容。 You can see this with dev tools in the browser, for example in Firefox use Firebug's 'script' tab and use the 'stack' output tab. 您可以在浏览器中使用开发工具查看此信息,例如在Firefox中,请使用Firebug的“脚本”标签,并使用“堆栈”输出标签。

Just noticed you'd said you'd tried to get a stack trace. 只是注意到您说过您试图获取堆栈跟踪。 Try putting a breakpoint at the line you know is bad and looking at the stacktrace to see if/when it seems to be recursing into some function above that line. 尝试在您知道不好的行上放置一个断点,然后查看stacktrace以查看是否/何时将其递归到该行之上的某个函数中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM