Bug 348652 - Crash (Segmentation fault) when editing large file
Summary: Crash (Segmentation fault) when editing large file
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 2.9.4
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
: 348697 348712 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-06-03 17:38 UTC by Tyson Tan
Modified: 2015-07-22 15:00 UTC (History)
5 users (show)

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


Attachments
Krita crash backtrace when editing large file (9.27 KB, text/plain)
2015-06-03 17:39 UTC, Tyson Tan
Details
Affected kritarc (19.57 KB, text/plain)
2015-06-04 01:59 UTC, Tyson Tan
Details
Another backtrace of a complete fresh build (12.46 KB, text/plain)
2015-06-04 16:43 UTC, Tyson Tan
Details
New crash information added by DrKonqi (8.45 KB, text/plain)
2015-07-22 15:00 UTC, grean
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tyson Tan 2015-06-03 17:38:26 UTC
Krita crashed when I was editing large files. Returned segmentation fault message. It was fine until I rebuilt the binaries today. I suppose one commit on 2015-06-02 or 2015-06-03 caused it. Will attach backtrace file below.

Reproducible: Always

Steps to Reproduce:
1. Create a very large new file (A3 600dpi)
2. Draw something
3.

Actual Results:  
Krita crashed after a few brush strokes.

Expected Results:  
Krita does not crash.
Comment 1 Tyson Tan 2015-06-03 17:39:04 UTC
Created attachment 92978 [details]
Krita crash backtrace when editing large file
Comment 2 Halla Rempt 2015-06-03 17:55:40 UTC
Hm.... Dmitry should see this. I suspect that the new values for the memory pool option cause this. There's now a gui to set Krita's memory consumption characteristics, but it's a bit experimental :-)
Comment 3 Tyson Tan 2015-06-03 18:02:41 UTC
Additional information:
1. Once crashed, switching to master branch (has no today's commit yet) does not help.
2. Master branch build does not crash only when kritarc was deleted.

Anyway, congratulations on the 2nd successful kickstarter! :D
Comment 4 Halla Rempt 2015-06-03 18:34:52 UTC
Yes... that sounds like it is about todays commit -- because that saves a setting to kritarc, and krita already could read those settings, it just didn't provide a gui for them yet.
Comment 5 Dmitry Kazakov 2015-06-03 20:30:42 UTC
I cannot reproduce the crash. How much memory do you have?
Comment 6 Tyson Tan 2015-06-04 01:40:22 UTC
I have 16GiB RAM, 15.4GiB available because of intel HD graphics took some of it. I tried to remove one of the 2 memory modules. But no matter which I remove, it did not help.

It didn't crash when you push this commit:
http://quickgit.kde.org/?p=calligra.git&a=commit&h=38d77e007d7704795a87d1a1f5d8965260450536

The last working commit I know was:
http://quickgit.kde.org/?p=calligra.git&a=commit&h=4c9300e3c99c7bb4676bfb0876edd5ff97404e11
Comment 7 Tyson Tan 2015-06-04 01:59:04 UTC
Created attachment 92988 [details]
Affected kritarc

This is a copy of my old kritarc. It crashed Krita even when I was using Master branch builds.

Also, I did some more tests today: Krita 2.9 branch (new kritarc, settings untouched) >> Crashed >> Swich to Master branch >> Did not crash

So I think there must something in my old kritarc did it.
Comment 8 Dmitry Kazakov 2015-06-04 09:40:55 UTC
Hi, Tyson!

I still cannot reproduce anything like that :( Could you try doing a clean build? I changed quite a few really low-level things in Krita so it might be a reason.

First try to do a clean in ./image/ and if it doesn't help, then in entire Krita:

$ cd ./build-folder/calligra/krita/image
$ make clean
$ cd ../../
$ make -j8 install
# delete 'kritarc'

If it still crashes, then do a fully clean build:

$ cd ./build-folder/calligra/
$ make clean
$ make -j8 install
# delete 'kritarc'
Comment 9 Tyson Tan 2015-06-04 16:43:23 UTC
Created attachment 92999 [details]
Another backtrace of a complete fresh build

Hi Dmitry, I deleted everything in $HOME/.kde , cleared calligra's building and installation folder, downloaded the whole source code again and rebuilt it from scratch. Unfortunately, it still crashed after all these efforts.

However, not all was lost. The backtrace of this crash suggested something about krita's swap, so I changed swap size from the default 4 GiB to 1 GiB. Krita didn't crash after that. Then I changed it back to 4 GiB. Strangely enough, it didn't crash after that either.

Now that I think of it, my last working build was before this commit:
http://quickgit.kde.org/?p=calligra.git&a=commit&h=073c999cc0495dc050ba81225a676789ba84efce

So could there be some inconsistency in kritarc that requires a user to flip some switches to get the new workable value?
Comment 10 Halla Rempt 2015-06-05 05:32:47 UTC
Raghukamath and Nataly Novak reported the same crash on #krita. Raghukamath said he 'fixed' it by making the swap size for undo a lot bigger.

Can you check what the value for 'swaplocation' is in your kritarc and what it's set to in the settings dialog?
Comment 11 Halla Rempt 2015-06-05 05:42:51 UTC
I've reproduced the issue:

(gdb) bt
#0  0x00007fffeebaae49 in __memcpy_sse2_unaligned () at /lib64/libc.so.6
#1  0x00007ffff693ef59 in KisSwappedDataStore::swapOutTileData(KisTileData*) (this=this@entry=0x28d18b8, td=td@entry=0x7fff30a09a00)
    at /home/boud/kde/src/2.9/krita/image/tiles3/swap/kis_swapped_data_store.cpp:78
#2  0x00007ffff6915311 in KisTileDataStore::trySwapTileData(KisTileData*) (this=0x28d1860, td=0x7fff30a09a00) at /home/boud/kde/src/2.9/krita/image/tiles3/kis_tile_data_store.cc:257
#3  0x00007ffff693f893 in KisTileDataSwapper::pass<SoftSwapStrategy>(long long) (td=<optimized out>, this=0x7fffbc00b230) at /home/boud/kde/src/2.9/krita/image/tiles3/kis_tile_data_store_iterators.h:62
#4  0x00007ffff693f893 in KisTileDataSwapper::pass<SoftSwapStrategy>(long long) (this=this@entry=0x28d18a0, needToFreeMetric=489183)
    at /home/boud/kde/src/2.9/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:229
#5  0x00007ffff693f629 in KisTileDataSwapper::doJob() (this=0x28d18a0) at /home/boud/kde/src/2.9/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:133
#6  0x00007ffff693f692 in KisTileDataSwapper::run() (this=0x28d18a0) at /home/boud/kde/src/2.9/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:99
#7  0x00007fffefe5579f in  () at /usr/lib64/libQtCore.so.4
#8  0x00007fffefbbf0a4 in start_thread () at /lib64/libpthread.so.0
#9  0x00007fffeec0006d in clone () at /lib64/libc.so.6
(gdb)
Comment 12 Halla Rempt 2015-06-05 05:47:56 UTC
*** Bug 348712 has been marked as a duplicate of this bug. ***
Comment 13 Raghavendra kamath 2015-06-05 06:15:29 UTC
*** Bug 348697 has been marked as a duplicate of this bug. ***
Comment 14 Halla Rempt 2015-06-05 06:23:53 UTC
Git commit 336928028c071be4c825c9bff63aabf299211bfa by Boudewijn Rempt.
Committed on 05/06/2015 at 06:23.
Pushed by rempt into branch 'calligra/2.9'.

M  +7    -9    krita/image/tiles3/swap/kis_memory_window.cpp
M  +4    -4    krita/image/tiles3/swap/kis_memory_window.h

http://commits.kde.org/calligra/336928028c071be4c825c9bff63aabf299211bfa
Comment 15 Tyson Tan 2015-06-05 07:34:00 UTC
Hi, Boud.
After the patch, Krita did not crash with fresh kritarc, so far. Thanks!

In my case, a fresh kritarc has no item called swaplocation in it, but Configure Krita dialogue automatically points to /tmp/kde-tysontan/krita (This is what happened after the patch, I think it's the same before the patch, but I'm not so sure.) When I click […] it leads me to my home folder. I canceled after that, then text of “/tmp/kde-tysontan/krita” displayed in the dialogue disappeared. “/tmp/kde-tysontan/krita ” returns when I re-open Configure Krita dialogue.

After I changed the swap size, swaplocation= in kritarc appeared with empty value.

I don't have a swap partition on my SSD, by the way.
Comment 16 grean 2015-07-22 15:00:24 UTC
Created attachment 93694 [details]
New crash information added by DrKonqi

krita (2.9.5) on KDE Platform 4.14.8 using Qt 4.8.6

Application crashes after one brush stroke.

-- Backtrace (Reduced):
#6  __memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:35
#7  0x00007fe7b6d56fd5 in KisSwappedDataStore::swapOutTileData(KisTileData*) () from /usr/lib/libkritaimage.so.14
#8  0x00007fe7b6d3b8dc in KisTileDataStore::trySwapTileData(KisTileData*) () from /usr/lib/libkritaimage.so.14
#9  0x00007fe7b6d57af3 in long long KisTileDataSwapper::pass<SoftSwapStrategy>(long long) () from /usr/lib/libkritaimage.so.14
#10 0x00007fe7b6d5783d in KisTileDataSwapper::doJob() () from /usr/lib/libkritaimage.so.14