IE8: Out of stackspace error

517 views
Skip to first unread message

Johan Arensman

unread,
Feb 14, 2011, 11:22:41 AM2/14/11
to prototy...@googlegroups.com
Hey all,

I've updated the prototype version in my application from 1.6.0.3 to 1.7. Everything works just fine except for the fact that IE8 gives "Out of stackspace" errors.

The app dynamically loads several html pages / javascript files when you open different 'modules'. After the 1.7 update this still works fine, no errors but when I click a link to move to another page (so actually reload my page, no ajax call) I get the "Out of stackspace" error.

After some Googeling i found:
http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/f5878ea837bbaf3d/d19856a81273df80
with the same error but here it's caused by the JSON parser. I haven't used the JSON object at all, and the pages that are loaded don't use any JSON methods.

I've mailed with Tobie Langel to ask what the fix was for the JSON parser, but he replied:

Oh, sorry, looked at the bug report again.

No, your issue wasn't fixed and the only way I can imagine having it
fixed is to either stop using Prototype or not use native JSON in IE8.
 
When I press debug, and take a look at the stacktrace I see that the _destroyCache method is called and the out of stackspace error occurs when stopObserving is called on the registry.

Is this the cleanup routine from Prototype on unload?

I'm totally lost on how to handle this and I really don't want to revert to 1.6.0.3

Any tips are welcome!

Greetings,
 Johan

matti

unread,
Feb 15, 2011, 12:00:21 PM2/15/11
to Prototype: Core
Native JSON in IE8 is fixed (February 24, 2010) by Microsoft. -
http://support.microsoft.com/kb/976662

Could it be HTTP header related issue? Do you use X-JSON header?

-
Matti

On 14 helmi, 19:22, Johan Arensman <johanm...@gmail.com> wrote:
> Hey all,
>
> I've updated the prototype version in my application from 1.6.0.3 to 1.7.
> Everything works just fine except for the fact that IE8 gives "Out of
> stackspace" errors.
>
> The app dynamically loads several html pages / javascript files when you
> open different 'modules'. After the 1.7 update this still works fine, no
> errors but when I click a link to move to another page (so actually reload
> my page, no ajax call) I get the "Out of stackspace" error.
>
> After some Googeling i found:http://groups.google.com/group/prototype-scriptaculous/browse_thread/...

Andrew Dupont

unread,
Feb 15, 2011, 1:19:21 PM2/15/11
to prototy...@googlegroups.com
It doesn't sound like it's a JSON issue.

Can you set a breakpoint on the first line of _destroyCache and see what path it's taking through the code? That function shouldn't get anywhere near the call stack limit, so I suspect there's accidental infinite recursion happening somehow.

Cheers,
Andrew


--
You received this message because you are subscribed to the Google Groups "Prototype: Core" group.
To post to this group, send email to prototy...@googlegroups.com
To unsubscribe from this group, send email to prototype-cor...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en

Johan Arensman

unread,
Feb 16, 2011, 5:41:40 AM2/16/11
to prototy...@googlegroups.com
Hey Andrew,

Indeed I doubt it's caused by JSON.

The Call Stack the debugger gives me is:

each
 stopObserving
  _destroyCache

When I step through the first line (the for loop)
the values are:
i=0
length=67 (not that much?)

it continues to loop until i=45

CACHE[i] is then a HTMLInputElement (which actually exists)
I've also tested CACHE[46] and CACHE[47] in the Watch window and these elements also exist.

When i step in stopObserving when i=45, it breaks when it's looping over the registry variable on line 5666.
registry is an object. and the _object property has a length of 2, that's it.

When stepping into the iterator I get into Enumerable._each and it breaks. Throwing the out of stackspace error.

If I need to watch anything else feel free to ask, I have no clue how to handle this any further :$

I hope this helps

Greetings,
 Johan

Andrew Dupont

unread,
Feb 16, 2011, 12:25:09 PM2/16/11
to prototy...@googlegroups.com
If you can reproduce the stack overflow inside a debugger, it's got to be that you're hitting something that causes infinite recursion. The stack size in IE is large enough that you wouldn't exceed it through normal scripting, and you certainly wouldn't be able to encounter it by stepping through code in ordinary fashion in a debugger.

Is there any way you can make a reduced test case that I can play with? Have you reproduced this on more than one machine running IE8?

In any event, 1.7.0.1 will make it so that we don't have to loop through and manually unregister event handlers on unload, so there's a light at the end of the tunnel. I'm not sure when I'll be able to release it, though.

Cheers,
Andrew

Johan Arensman

unread,
Feb 17, 2011, 3:18:02 AM2/17/11
to prototy...@googlegroups.com
I can reproduce it on every machine with IE7 and 8. Don't know about IE9, don't have it here yet.

I'm afraid the application is too big to trim down to make a small testcase. If the unregister part of 1.7.0.1 is done/alpha/beta I would love to give it a testrun to see if that fixes my problem.

Thanks for your help so far Andrew!

Greetings,
 Johan Arensman
Reply all
Reply to author
Forward
0 new messages