Failed to load the requested file - with highly nested groups (>250)

Bug #943771 reported by Ricardo Aratani
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Undecided
Unassigned

Bug Description

I imported a file from PDF and after editing and saving it could not be loaded anymore.

So I troubleshot by deleting parts of the file and at some point it worked. I reached a certain <g> tag that if added would make it break. So I deleted it and copied another part of the file in its place. It also broke the file. I counted about 250 nested <g> tags, but can't be precise.
I recovered my file by simply moving nested code to the root, never exceeding 200 levels. It works.

The broken file is attached. You can reproduce the recovery by removing the code after line 57771 and closing the open tags. The file works again. If you paste the removed code back in chunks of 1600 lines, it also works.

Revision history for this message
Ricardo Aratani (ricardo-aratani) wrote :
Revision history for this message
Ricardo Aratani (ricardo-aratani) wrote :

This is the recovered file. Note that after line ~57800 I reinserted the code after closing the open <g> tags, to reduce nesting. That was the fix.

Revision history for this message
su_v (suv-lp) wrote :

Reproduced with Inkscape 0.48.2 and 0.48.3.1 on OS X 10.7.2:

/Volumes/cyan/devel/inkscape/bug/943771-sp_politico-zoom revA.svg:55712: parser error : Excessive depth in document: 256 use XML_PARSE_HUGE option
                                <path
                                ^
/Volumes/cyan/devel/inkscape/bug/943771-sp_politico-zoom revA.svg:55712: parser error : Extra content at the end of the document
                                <path
                                ^

Not reproduced with Inkscape 0.48+devel r11032 on OS X 10.7.2:
Inkscape trunk loads the file without warning or error messages, and also allows to unhide the layers, but memory usage is excessively high (grabbing _all_ resources available and causing paging for for other running applications).

Revision history for this message
su_v (suv-lp) wrote :

Related earlier report:
Bug #297070 “depth of xmlParserMaxDepth insufficient”
<https://bugs.launchpad.net/inkscape/+bug/297070>

Revision history for this message
su_v (suv-lp) wrote :

> parser error : Excessive depth in document: 256 use XML_PARSE_HUGE option

According to bug #297070 comment #4, 'XML_PARSE_HUGE' is already used (with max levels = 256):
«In rev 9775 I added XML_PARSE_HUGE flag to libxml parsing call, so now it no longer errors out on more than 256 nested groups. This bug and my own experience show that such documents happen from time to time, e.g. on import from PDF.»

Revision history for this message
su_v (suv-lp) wrote :

Proposing to set bug status to 'Fix committed' since the file opens in trunk (at least on osx) - @JazzyNico, @Alvin, would you mind testing with trunk on Linux/Windows?

Performance issues in trunk with such excessively nested levels of groups should probably tracked in a separate report.

Revision history for this message
su_v (suv-lp) wrote :

Actually, the fix for bug #297070 was never backported to the stable release branch:
<https://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/9775>

trunk, line 305:
<https://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/view/head:/src/xml/repr-io.cpp#L296>

0.48.x, line 297:
<http://bazaar.launchpad.net/~inkscape.dev/inkscape/RELEASE_0_48_BRANCH/view/head:/src/xml/repr-io.cpp#L288>

I will change the bug status of #297070 to 'Fix Committed' and link this report as duplicate. Please add a comment here and revert the duplicate status if you don't agree and think these are different issues.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.