Error 'script stack space quota is exhausted' when parsing 3MB XML file using Jquery

RESOLVED WORKSFORME

Status

()

Core
JavaScript Engine
RESOLVED WORKSFORME
7 years ago
6 years ago

People

(Reporter: Pete Warden, Unassigned)

Tracking

1.9.2 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
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.
(Reporter)

Comment 1

7 years ago
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
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?
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Mac OS X → All
Hardware: x86 → All
See Also: → bug 547967
Version: unspecified → 1.9.2 Branch
(Reporter)

Comment 3

7 years ago
Created attachment 458142 [details]
Test case - Minimal HTML page containing the script + data to load

Comment 4

7 years ago
Note:  https://bugzilla.mozilla.org/show_bug.cgi?id=596317
Bug 596317 - misleading error message: "script stack space quota is exhausted"

Comment 5

7 years ago
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

7 years ago
This was discussed in more depth/fixed way back here:
https://bugzilla.mozilla.org/show_bug.cgi?id=420869
this is removed by bug 644241
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.