Bug 421036 - Cannot load an svg file created by potrace
Summary: Cannot load an svg file created by potrace
Status: REPORTED
Alias: None
Product: krita
Classification: Applications
Component: Layers/Vector (show other bugs)
Version: 4.2.9
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2020-05-05 02:14 UTC by Matthew Trescott
Modified: 2020-08-03 17:54 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
SVG file that triggers the problem (216.33 KB, image/svg+xml)
2020-05-05 02:14 UTC, Matthew Trescott
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Trescott 2020-05-05 02:14:01 UTC
Created attachment 128157 [details]
SVG file that triggers the problem

SUMMARY
The attached svg file (which I generated with potrace) seems to make Krita eat up RAM. Shortly after selecting the PPI level I want, my computer freezes up and I start hearing my hard drive go crazy trying to write to swap. I had to ssh in and killall krita before the OOM killer kicked in. I can't actually confirm the memory usage level because top stopped working too.

STEPS TO REPRODUCE
1. Open the attached SVG file.
2. Select the default 100 ppi resolution.
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Matthew Trescott 2020-05-05 02:16:53 UTC
I just tested with the 5.0-prealpha AppImage, same issue seems to happen.
Comment 2 Halla Rempt 2020-05-05 07:45:52 UTC
Hm, curious, if I open your file in inkscape and save it, it opens fine in Krita, but the original file doesn't.
Comment 3 Halla Rempt 2020-05-05 07:48:37 UTC
Even more curious, if I attach gdb to the running Krita process, it loads...
Comment 4 Halla Rempt 2020-05-05 07:52:18 UTC
Huh... No, it's not that. I have had one session where krita started eating memory like crazy, but now I've been able to load your image a couple of times in a row. It's crazy big, though: 29,639 by 16,000 pixels at 100 dpi, which means it takes about 1,4gb of memory.
Comment 5 Matthew Trescott 2020-05-05 13:03:58 UTC
Yeah, definitely not an optimized SVG by any means. After trying some different options to try to reduce the number of nodes in the potrace output I got a much better result that doesn't seem to cause problems with Krita either, which is weird. So it doesn't seem to happen with every svg generated by potrace.
Comment 6 Tiar 2020-08-03 17:54:52 UTC
A counter "how big this layer will be (pixels, bytes) if you choose this and this ppi" in the dialog is possible, and I believe it would improve the UX greatly, however it doesn't seem to be the only issue here.

The rapid increasing of RAM needed suggests an infinite loop somewhere, however it doesn't seem to be easily reproducible.