Last Comment Bug 579656 - Error 'script stack space quota is exhausted' when parsing 3MB XML file using Jquery
: Error 'script stack space quota is exhausted' when parsing 3MB XML file using...
Status: RESOLVED WORKSFORME
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: 1.9.2 Branch
: All All
: -- normal with 4 votes (vote)
: ---
Assigned To: general
:
: Jason Orendorff [:jorendorff]
Mentors:
http://firefox-stack-bug.s3.amazonaws...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-17 09:02 PDT by Pete Warden
Modified: 2011-06-04 08:47 PDT (History)
10 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Test case - Minimal HTML page containing the script + data to load (595.50 KB, application/zip)
2010-07-17 21:28 PDT, Pete Warden
no flags Details

Description Pete Warden 2010-07-17 09:02:52 PDT
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6

I've spun this off as a new bug from https://bugzilla.mozilla.org/show_bug.cgi?id=547967 on Boris Zbarsky's advice.

I'm running into 'script stack space quota is exhausted' when loading a 3.4MB XML file using JQuery, and
have created a minimal example that reproduces the problem at http://firefox-stack-bug.s3.amazonaws.com/index.html


Reproducible: Always

Steps to Reproduce:
1 - Open http://firefox-stack-bug.s3.amazonaws.com/index.html in Firefox
2 - After a few seconds check the error console

Actual Results:  
The code fails with the message 

Error: script stack space quota is exhausted
Source File: http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
Line: 21

Expected Results:  
The XML file should be loaded and parsed

The same page runs with no problems in Safari 5.0 and Chrome 6.0. 
My full Firefox version is 

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.6)
Gecko/20100625 Firefox/3.6.6

You can download a zip of the source files at
http://web.mailana.com/labs/firefox_stack_bug.zip

Boris noted:
"what happens is that execution of the relevant regexp needs more than 65MB of backtrack stack data, which is what makes you get the error message.  The relevant js_ReportOutOfScriptQuota call is PushBackTrackState here:

3520            btincr = JS_ROUNDUP(btincr, btsize);
3521            JS_ARENA_GROW_CAST(gData->backTrackStack, REBackTrackData *,
3522                               &gData->cx->regexpPool, btsize, btincr);
3523            if (!gData->backTrackStack) {
3524                js_ReportOutOfScriptQuota(gData->cx);"

I'll also be contacting the JQuery team to see if they have any insight, but since it runs on other platforms it seems worth looking into what's different on Firefox.

I've also run the XML file through the validator at http://validator.w3.org and the syntax is valid.
Comment 1 Pete Warden 2010-07-17 11:52:28 PDT
I've filed this bug with the JQuery team to track any fixes that could be applied on the framework side:
http://dev.jquery.com/ticket/6796
Comment 2 Nochum Sossonko [:Natch] 2010-07-17 20:29:02 PDT
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 (.NET CLR 3.5.30729)
Confirmed. Still haven't checked trunk builds.

Pete, can you attach the testcase to the bug?
Comment 3 Pete Warden 2010-07-17 21:28:07 PDT
Created attachment 458142 [details]
Test case - Minimal HTML page containing the script + data to load
Comment 4 Jerry Lugert 2010-10-14 16:16:52 PDT
Note:  https://bugzilla.mozilla.org/show_bug.cgi?id=596317
Bug 596317 - misleading error message: "script stack space quota is exhausted"
Comment 5 Jerry Lugert 2010-10-14 17:48:13 PDT
FYI see http://entanglednetworks.com/foo

fx  = 1.25M
chrome = 105M

I'm hitting the limit in fx3.6.10 using lucidchart  with ~15 tabs.
Comment 6 Jerry Lugert 2010-10-14 17:52:15 PDT
This was discussed in more depth/fixed way back here:
https://bugzilla.mozilla.org/show_bug.cgi?id=420869
Comment 7 Kevin Brosnan [:kbrosnan] 2011-06-04 08:47:19 PDT
this is removed by bug 644241

Note You need to log in before you can comment on or make changes to this bug.