Bug 469945 - Krita Nightly crashed by any action after started for a while
Summary: Krita Nightly crashed by any action after started for a while
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: * Unknown (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
: 470857 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-05-18 12:15 UTC by Tyson Tan
Modified: 2023-06-15 09:49 UTC (History)
4 users (show)

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


Attachments
Krita usage log (103.83 KB, text/plain)
2023-05-18 12:15 UTC, Tyson Tan
Details
Krita system information (10.72 KB, text/plain)
2023-05-18 12:17 UTC, Tyson Tan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tyson Tan 2023-05-18 12:15:56 UTC
Created attachment 159072 [details]
Krita usage log

Krita Nightly crashed after a few brush strokes. I'm using appimage on Archlinux. I noticed this crash in the latest build (cdb36cb4f0, 2023-05-17). I was unable to reproduce this in the prior build (a92c1c611a, 2023-05-16).
Comment 1 Tyson Tan 2023-05-18 12:17:23 UTC
Created attachment 159074 [details]
Krita system information

I have encountered the same kind of crash on two different machines. I'm attaching one of the system information here.
Comment 2 Lynx3d 2023-05-18 16:51:50 UTC
This is really strange, as between those commits only translations changed.
But I think you just failed to reproduce on the other build for whatever reason, I have worked on line art for several hours with cdb36cb4f0 (own build) just fine, and then started to do colors and it also started to crash after a couple of brush strokes on each attempt.

I was able to get a backtrace (for some reason KCrash can't catch it, had to run in gdb directly):

Thread 21 "Thread (pooled)" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffa8ffc640 (LWP 32308)]
0x00007ffff55e1a06 in QMapDataBase::rebalance(QMapNodeBase*) () from /opt/qt515-kde/lib/libQt5Core.so.5
(gdb) bt
#0  0x00007ffff55e1a06 in QMapDataBase::rebalance(QMapNodeBase*) () at /opt/qt515-kde/lib/libQt5Core.so.5
#1  0x00007ffff55e1fcc in QMapDataBase::createNode(int, int, QMapNodeBase*, bool) () at /opt/qt515-kde/lib/libQt5Core.so.5
#2  0x00007ffff6fb43aa in QMapData<int, QMap<int, QMap<double, QImage> > >::createNode(int const&, QMap<int, QMap<double, QImage> > const&, QMapNode<int, QMap<int, QMap<double, QImage> > >*, bool)
    (this=0x55557cf83a80, k=@0x7fffa8ffb978: 33, v=..., parent=<optimized out>, left=<optimized out>)
    at /opt/qt515-kde/include/QtCore/qmap.h:226
#3  0x00007ffff6fb4970 in QMap<int, QMap<int, QMap<double, QImage> > >::insert(int const&, QMap<int, QMap<double, QImage> > const&)
    (avalue=..., akey=@0x7fffa8ffb978: 33, this=0x555571af54c0) at /opt/qt515-kde/include/QtCore/qmap.h:733
#4  QMap<int, QMap<int, QMap<double, QImage> > >::operator[](int const&)
    (this=this@entry=0x555571af54c0, akey=akey@entry=@0x7fffa8ffb978: 33) at /opt/qt515-kde/include/QtCore/qmap.h:683
#5  0x00007ffff6fa0995 in KisPaintDeviceCache::cacheThumbnail(int, int, double, QImage)
    (image=<incomplete type>, oversample=<optimized out>, h=<optimized out>, w=<optimized out>, this=0x555571af5438)
    at /home/lynx/coding/krita/krita-git/libs/image/kis_paint_device_cache.h:114
#6  KisPaintDeviceCache::createThumbnail(int, int, double, KoColorConversionTransformation::Intent, QFlags<KoColorConversionTransformation::ConversionFlag>)
    (conversionFlags=..., renderingIntent=KoColorConversionTransformation::IntentPerceptual, oversample=1, h=36, w=33, this=0x555571af5438) at /home/lynx/coding/krita/krita-git/libs/image/kis_paint_device_cache.h:94
#7  KisPaintDevice::createThumbnail(int, int, double, KoColorConversionTransformation::Intent, QFlags<KoColorConversionTransformation::ConversionFlag>)
    (this=<optimized out>, w=<optimized out>, h=<optimized out>, oversample=1, renderingIntent=KoColorConversionTransformation::IntentPerceptual, conversionFlags=...) at /home/lynx/coding/krita/krita-git/libs/image/kis_paint_device.cc:1828
#8  0x00007ffff6fa0cf8 in KisPaintDevice::createThumbnail(int, int, Qt::AspectRatioMode, double, KoColorConversionTransformation::Intent, QFlags<KoColorConversionTransformation::ConversionFlag>)
    (this=0x555571af5310, maxw=maxw@entry=36, maxh=maxh@entry=36, aspectRatioMode=aspectRatioMode@entry=Qt::KeepAspectRatio, oversample=oversample@entry=1, renderingIntent=renderingIntent@entry=KoColorConversionTransformation::IntentPerceptual, conversionFlags=...)
    at /home/lynx/coding/krita/krita-git/libs/image/kis_paint_device.cc:1838
#9  0x00007ffff6efa6f8 in KisLayer::createThumbnail(int, int, Qt::AspectRatioMode)
    (this=<optimized out>, w=36, h=36, aspectRatioMode=Qt::KeepAspectRatio) at /opt/qt515-kde/include/QtCore/qflags.h:121
#10 0x00007ffff785f24a in ThumbnailsStroke::initStrokeCallback()::{lambda(KisSharedPtr<KisNode>)#1}::operator()(KisSharedPtr<KisNode>) 
onst::{lambda()#1}::operator()() (__closure=0x7fff8c089680) at /home/lynx/coding/krita/krita-git/libs/ui/KisLayerThumbnailCache.cpp:71
#11 std::__invoke_impl<void, ThumbnailsStroke::initStrokeCallback()::{lambda(KisSharedPtr<KisNode>)#1}::operator()(KisSharedPtr<KisNode>) const::{lambda()#1}&>(std::__invoke_other, ThumbnailsStroke::initStrokeCallback()::{lambda(KisSharedPtr<KisNode>)#1}::operator()(KisSharedPtr<KisNode>) const::{lambda()#1}&) (__f=...) at /usr/include/c++/11/bits/invoke.h:61
#12 std::__invoke_r<void, ThumbnailsStroke::initStrokeCallback()::{lambda(KisSharedPtr<KisNode>)#1}::operator()(KisSharedPtr<KisNode>) const::{lambda()#1}&>(ThumbnailsStroke::initStrokeCallback()::{lambda(KisSharedPtr<KisNode>)#1}::operator()(KisSharedPtr<KisNode>) const::{lambda()#1}&) (__fn=...) at /usr/include/c++/11/bits/invoke.h:111
#13 std::_Function_handler<void (), ThumbnailsStroke::initStrokeCallback()::{lambda(KisSharedPtr<KisNode>)#1}::operator()(KisSharedPtr<KisNode>) const::{lambda()#1}>::_M_invoke(std::_Any_data const&) (__functor=<optimized out>)
    at /usr/include/c++/11/bits/std_function.h:290
#14 0x00007ffff6c7a180 in KisStrokeJob::run() (this=<optimized out>)
    at /media/bigstuff/krita/build/libs/image/kritaimage_autogen/EWIEGA46WW/../../../../../../../../home/lynx/coding/krita/krita-git/libs/image/kis_stroke_job.h:32
#15 KisUpdateJobItem::runImpl() (this=0x5555729510b0)
    at /media/bigstuff/krita/build/libs/image/kritaimage_autogen/EWIEGA46WW/../../../../../../../../home/lynx/coding/krita/krita-git/libs/image/kis_update_job_item.h:100
#16 KisUpdateJobItem::run() (this=0x5555729510b0)
    at /media/bigstuff/krita/build/libs/image/kritaimage_autogen/EWIEGA46WW/../../../../../../../../home/lynx/coding/krita/krita-git/libs/image/kis_update_job_item.h:49
#17 0x00007ffff55a73e2 in  () at /opt/qt515-kde/lib/libQt5Core.so.5
#18 0x00007ffff55a4133 in  () at /opt/qt515-kde/lib/libQt5Core.so.5
#19 0x00007ffff50f7b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#20 0x00007ffff5189a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
Comment 3 vanyossi 2023-05-18 17:27:39 UTC
I could not reproduce this issue after painting for 30min on macOS. the trigger could be something specific
Comment 4 Tyson Tan 2023-05-18 18:14:06 UTC
I attached the KRA file which I experienced the crash below:
https://www.dropbox.com/s/14h2405l8glhs4n/fanart_20230331A_20190211_celeste.zip?dl=0

I was using a custom brush. 
Engine: Pixel
Brush tip: Image -- chisel_soft
Size: 92.46px
General:
Size -> Pressure (Exponential upward curve)
Rotation -> Direction (Linear)
Texture:
Strength -> Pressure (Linear) 100%

I was drawing on the Layer named "Maddy". It's a normal layer.

I was drawing slowly for the long black lines along the character's boots. Krita would not handle more than 10 strokes before it froze, and then crashed immediately afterward without any message.

I also received a libwacom package update on Archlinux today before using Krita. I wonder if that could be related.
Comment 5 Tyson Tan 2023-05-27 08:30:52 UTC
Tested with today's appimage: krita-5.2.0-prealpha-e6c66a0bd4-x86_64.appimage

It appeared that the crash has nothing to do with brush action specifically. Krita would just crash by doing anything, after started for a while. It wouldn't crash on its own. It'd crash by doing any action or by just closing the document.
Comment 6 Alvin Wong 2023-06-10 13:40:44 UTC
*** Bug 470857 has been marked as a duplicate of this bug. ***
Comment 7 Dmitry Kazakov 2023-06-12 16:17:46 UTC
Git commit 950c63ccdbffd668e6a05ab19c607f8b23cf2efe by Dmitry Kazakov.
Committed on 12/06/2023 at 16:17.
Pushed by dkazakov into branch 'master'.

Fix unsafe concurrent access in KisPaintDeviceCache

Before the async layer thumbnails cache implementation was added,
the GUI thread was the only one who accessed the paint device's
cache. Now it has changed, so we should guard that with an rw-lock.

M  +22   -21   libs/image/kis_paint_device_cache.h

https://invent.kde.org/graphics/krita/-/commit/950c63ccdbffd668e6a05ab19c607f8b23cf2efe
Comment 8 Tyson Tan 2023-06-15 09:49:39 UTC
Thanks, Dmitry! :)