Bug 430458 - Krita crash on attempt to load a file with a huge resolution (not file size!)
Summary: Krita crash on attempt to load a file with a huge resolution (not file size!)
Status: RESOLVED NOT A BUG
Alias: None
Product: krita
Classification: Applications
Component: Tile manager (other bugs)
Version First Reported In: 4.4.1
Platform: Compiled Sources Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-16 13:20 UTC by Denys Motornyi
Modified: 2020-12-17 09:36 UTC (History)
1 user (show)

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


Attachments
30000x30000 1bit per pixel (939.80 KB, image/png)
2020-12-16 13:20 UTC, Denys Motornyi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denys Motornyi 2020-12-16 13:20:08 UTC
Created attachment 134117 [details]
30000x30000 1bit per pixel

SUMMARY
Krita crash on attempt to load a file with a huge resolution (not file size!)

STEPS TO REPRODUCE
1. Load the attached file (boom.png - 30000x30000 1bit per pixel)
2. Observe result


OBSERVED RESULT
Krita hangs when try load the file and then it will crash and close.

EXPECTED RESULT
Krita will assess the file based on metadata - resolution. Krita will not attempt to load the file that it is not able to load anyway. Krita will not crash. Krita will show a message saying the file cannot be opened.

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

ADDITIONAL INFORMATION
The attached file was actually made to perform edge-case testing of other image processing software, but I just wanted to check if Krita could handle this. And it appears that it has the same issue (

The test PC had 32 Gb of RAM, and Krita took most of it before crash.
Comment 1 Halla Rempt 2020-12-16 13:34:07 UTC
The minimum size per pixel in Krita is 16 bits if the image is grayscale, so 1 bit per pixel is not possible. The size in memory is w * h * bytes per pixel * number of layers + 1.

On my Linux laptop with 32 gb, this image loads fine, takes 3.4gb of memory, while Krita as a whole takes 5gb according to the system monitor.
Comment 2 Halla Rempt 2020-12-16 13:35:26 UTC
Oh, and the image is actually RGBA, so the expected memory consumption would be 3600000000 bytes (because there's only one layer, the projection is shared with the layer itself) -- which is more or less what we see.
Comment 3 Halla Rempt 2020-12-16 13:36:58 UTC
Oh, two more things:

* Did you really build Krita yourself?
* Did you run an x86 or x64 version of Krita?
Comment 4 Denys Motornyi 2020-12-16 15:30:07 UTC
Ok, it appears there is something else. I cannot reproduce the crash anymore.  

What I still face is that the memory usage is really high. While Krita loads the image, the peak is around 22Gb according to they system monitor. Once the image has loaded, it goes down to 11-12Gb. 

I didn't build Krita myself, I use the readily available x64 build. 

So the way it is stated the bug is irrelevant. Sorry for false alarm
Comment 5 Halla Rempt 2020-12-16 15:47:33 UTC
Do you have a really large amount of resources, like brush presets or patterns or things like that installed? Krita 4 loads all resources into memory (something we've already changed for what will become Krita 5), and if you've got a couple of 30000x30000 patters in your patterns folder, well, those are 3 gb per pattern :-)
Comment 6 Denys Motornyi 2020-12-16 16:17:14 UTC
Hmm.. ok, it makes sense. Except that I though I only have what comes with the default Krita installation, and nothing additional. I'll doublecheck, maybe somehow something has left over from older installations.
Comment 7 Bug Janitor Service 2020-12-17 04:34:23 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.