Side navigation
#6796 closed bug (fixed)
Opened July 17, 2010 06:16PM UTC
Closed October 17, 2010 07:31PM UTC
Last modified March 13, 2012 11:09PM UTC
Error 'script stack space quota is exhausted' when parsing 3MB XML file on Firefox
Reported by: | petewarden | Owned by: | petewarden |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.3 |
Component: | core | Version: | 1.4.2 |
Keywords: | xml firefox | Cc: | |
Blocked by: | Blocking: |
Description
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
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
I've filed the following bug with the Firefox team since there's no problem when running on other platforms, but since it's JQuery code that's causing the error I'm filing one here too, in case there's a fix I could use in the framework, rather than waiting for a Mozilla patch.
Attachments (0)
Change History (10)
Changed July 17, 2010 06:38PM UTC by comment:1
Changed July 21, 2010 02:30AM UTC by comment:2
component: | unfiled → core |
---|
It looks like you're trying to parse an XML string with
$()and that's not supported. Only HTML strings can be passed. If I've interpreted the test case incorrectly, reply with an explanation of what's going on.
Firefox seems to be dying on the constructor check for HTML, which uses a RegExp:
match = quickExpr.exec( selector );
The string you're passing in is long and html-ish, and I suspect Firefox is backtracking heavily trying to match the huge string. We can either assume a long (>1K chars) string must be HTML or come up with a RegExp that doesn't need to backtrack so much.
Changed July 24, 2010 07:07PM UTC by comment:3
Should I move this to the documentation component then? It looks like I'm not the only one who mistakenly thinks XML parsing is supported, see these tutorials listed on the main JQuery site at http://docs.jquery.com/Tutorials:
http://marcgrabanski.com/articles/jquery-makes-parsing-xml-easy
http://www.xml.com/pub/a/2007/10/10/jquery-and-xml.html
The only documentation I can find by doing a Google query of 'site:jquery.com xml parsing not supported' is this forum thread mentioning it at the end.
Changed September 23, 2010 09:22PM UTC by comment:4
This bug may now be fixed. The recent Regex improvements (see #7062) included a change to the quickExpr
regex which dramatically reduced the backtracking it required for the case of non-matches.
Changed September 27, 2010 10:44AM UTC by comment:5
I checked out the newest version from git, and I still have the same problems as the TS.
@ridgerunner: Were the changes committed to git, or were you talking about a non-git patch to reduce the backtracking?
Changed October 14, 2010 03:13AM UTC by comment:6
priority: | → undecided |
---|
Can anyone confirm for sure whether this issue is still being experienced using the new 1.4.3 RC2?
Changed October 15, 2010 10:16PM UTC by comment:7
owner: | → petewarden |
---|---|
status: | new → pending |
Please confirm whether or not this issue still occurs with jQuery 1.4.3. Thank you!
Changed October 17, 2010 06:59PM UTC by comment:8
status: | pending → new |
---|
I've confirmed that the problem doesn't occur with 1.4.3, so this bug can be closed
Changed October 17, 2010 07:31PM UTC by comment:9
resolution: | → fixed |
---|---|
status: | new → closed |
Changed January 06, 2011 12:54PM UTC by comment:10
The low limit still exists in Firefox. Given this, I think dmethvin's suggestion to assume anything over 1K is HTML is reasonable.
In my case, I'm using the jstree plugin which is taking a rather large XML document and using XSLT to turn it to a string containing an HTML nested list, which it then passes to jQuery's constructor to create DOM objects. I get the "stack quota" error in the same RegExp call mentioned in this ticket.
To reproduce, open http://jsfiddle.net/6GvyJ/ with Firefox (in my case 3.6.13) with Firebug enabled. The script simply dynamically creates a large string containing the html for an unordered list. I've tweaked the len variable to be right over the edge of Firefox's limit. Set len to 71859 and the script will work.
In Chrome, I was able to set len to several hundred thousand before I started having issues.
I've just tried it on IE 8, and the test page runs successfully, if slowly, so it appears to be a Firefox-specific issue.