glib fails: XML parse error: cannot load more than 200000 XML elements
Opened this issue · 4 comments
This bug seems to have been introduced after auto upgrading software on Ubuntu 22.04.4 LTS.
The SVG file can be downloaded here: https://drive.google.com/file/d/1CgmsNZK-5-hTRwd09mSZI3umVmfCcsX2/view?usp=sharing
`
teg@teg-desktop:~/workspace/graph_presenter$ RENDER_SIZE=50000 ./generate_presentation.sh 2004.svg 2004
Starting processing of 2004.svg 2022-0803 12:56
-
VIPS_ONLY==auto and vips version 8.9.0 >= 8.9.0. Setting VIPS_ONLY=true
-
VIPS_ONLY==true and RENDER_PNG==auto. Setting RENDER_PNG=false
-
Skipping rendering of PNG as RENDER_PNG=auto
-
Generating DeepZoom tiles in 2004/2004_files using vips from SVG with DPI=87
glib: XML parse error: cannot load more than 200000 XML elements -
Extracting linked node data to 2004/linked.js
Activating 8 seds @ 500 rules (out of 86077 total rules) number 1 at 2022-08-03 12:57
Activating 8 seds @ 500 rules (out of 86077 total rules) number 2 at 2022-08-03 12:58
Activating 8 seds @ 500 rules (out of 86077 total rules) number 3 at 2022-08-03 12:59
`
This is due to an internal limit in librsvg
. In some versions it was 200,000 elements, now presumably changed to 1,000,000: https://gitlab.gnome.org/GNOME/librsvg/-/blob/main/src/limits.rs The change is duscussed at https://gitlab.gnome.org/GNOME/librsvg/-/issues/574
Unfortunately this is not really a fix as the specific purpose of graph_presenter is to handle SVGs with a lot of elements. Two solutions comes to mind:
- Compile and install
librsvg
with a limit of a billion or similar high value - Split the SVG into parts and perform multi pass rendering
Option 2 seems like the right one as we cannot require users to perform changes to their local system. It does not seem trivial though. I'll have to look more into it.
Deleted above. I see there is a new push again.
It seems like newer versions of librsvg
has resulted in a size limit of 32K*32K for rendering: libvips/libvips#2296
It might be possible to work around this by hacking the viewport
in the SVG.