"Stack overflow in line 0" on Internet Explorer

250,282

Solution 1

You can turn off the "Disable Script Debugging" option inside of Internet Explorer and start debugging with Visual Studio if you happen to have that around.

I've found that it is one of few ways to diagnose some of those IE specific issues.

Solution 2

I ran into this problem recently and wrote up a post about the particular case in our code that was causing this problem.

http://cappuccino.org/discuss/2010/03/01/internet-explorer-global-variables-and-stack-overflows/

The quick summary is: recursion that passes through the host global object is limited to a stack depth of 13. In other words, if the reference your function call is using (not necessarily the function itself) was defined with some form window.foo = function, then recursing through foo is limited to a depth of 13.

Solution 3

Aha!

I had an OnError() event in some code that was setting the image source to a default image path if it wasn't found. Of course, if the default image path wasn't found it would trigger the error handler...

For people who have a similar problem but not the same, I guess the cause of this is most likely to be either an unterminated loop, an event handler that triggers itself or something similar that throws the JavaScript engine into a spin.

Solution 4

I had this problem, and I solved it. There was an attribute in the <%@ Page tag named MaintainScrollPositionOnPostback and after removing it, the error disapeared. I added it before to prevent scrolling after each postback.

Solution 5

If you came here because you had the problem inside your selenium tests: IE doesn't like By.id("xyz"). Use By.name, xpath, or whatever instead.

Share:
250,282
user1539401
Author by

user1539401

I'm a programmer who has worked with a few different languages and platforms over the years and learned a lot from all of them. My core skills include C#, JavaScript, Ruby, SQL and web development in general, but I'm also passable with Java, Python, PHP, Perl and some shell scripting dialects. Programming is fun but if I could make training horses my day job, I probably would.

Updated on March 18, 2020

Comments

  • user1539401
    user1539401 over 4 years

    I realise this is not the ideal place to ask about this in terms of searchability, but I've got a page whose JavaScript code throws "Stack overflow in line 0" errors when I look at it in Internet Explorer.

    The problem is quite clearly not in line 0, but somewhere in the list of stuff that I'm writing to the document. Everything works fine in Firefox, so I don't have the delights of Firebug and friends to assist in troubleshooting.

    Are there any standard causes for this? I'm guessing this is probably an Internet Explorer 7 bug or something quite obscure, and my Google-fu is bringing me little joy currently. I can find lots of people who have run into this before, but I can't seem to find how they solved it.

  • user1539401
    user1539401 over 14 years
    The cause of the error is typically an unterminated loop or recursive call that just overloads the Javascript engine, but that can happen in a whole lot of different ways.
  • user1539401
    user1539401 over 14 years
    Very interesting insight into the roots of the problem.
  • Peter Mortensen
    Peter Mortensen about 13 years
    Isn't this just treating the symptom?
  • Marcelo
    Marcelo about 13 years
    Thanks, that was my problem too.
  • DestiX
    DestiX over 12 years
    smartNavigation is deprecated, so you should use maintainScrollPositionOnPostBack only. This solved the problem for me.
  • kad81
    kad81 about 12 years
    My users suddenly started receiving this error after I added these attributes to the pages tag, but only when using IE, so I did not experience the problem myself. Not having any clue to link the two together, I was completely lost for a solution until I found this answer.
  • dmansfield
    dmansfield almost 12 years
    this was somewhat similar to my problem. i'm not sure how the "recursion" happened, but i had a missing resource (empty.html) used in some iframe, and the empty.html was missing in one of my deployments. i checked my access log based on this answer, found the 404 and added the missing file. voila!
  • user1539401
    user1539401 over 11 years
    Could you have been cloning an element that included the code that called clone? That would have that effect I reckon.
  • Kemal Dağ
    Kemal Dağ over 11 years
    and treating the symptom only for one patient, where as possibly millions of them are not getting the treatment.
  • Cinder
    Cinder over 11 years
    Javascript, not Java. And what's flash got to do with anything?
  • user1539401
    user1539401 over 10 years
    Like most of the examples here, this is almost certainly a recursive loop- if your propertychange event changes a property of the element, it would trigger itself again, causing exactly this type of exception.