Bug 459252

Summary: Filter layers crashes on large files
Product: [Applications] krita Reporter: Razvan Radulescu <razcore.rad>
Component: Filter LayersAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: halla, info, intuos5
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Krita Sysinfo
Video Steps to Crash

Description Razvan Radulescu 2022-09-17 06:48:36 UTC
Created attachment 152139 [details]
Krita Sysinfo

SUMMARY
Crash on save with filer layers for large files (>4K)
git hash: 4126e6d

STEPS TO REPRODUCE
1. Create a 4K image (7680x4320)
2. Add Filter Layer, e.g. Color Adjustment
3. Save the file

OBSERVED RESULT

Instant crash.

EXPECTED RESULT
File gets saved without crash.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:  Ubuntu 22.04.1 LTS
Qt Version: 5.12.12

ADDITIONAL INFORMATION
See attached file for full system info.
Comment 1 Halla Rempt 2022-09-17 09:36:06 UTC
I cannot reproduce a crash. Is this 100% reproducible for you? 

Do you see any interesting messages about asserts on the terminal if you start Krita from there? Do you get a backtrace if you run Krita in GDB?
Comment 2 Razvan Radulescu 2022-09-18 09:43:54 UTC
Created attachment 152181 [details]
Video Steps to Crash
Comment 3 Razvan Radulescu 2022-09-18 09:46:04 UTC
(In reply to Halla Rempt from comment #1)
> I cannot reproduce a crash. Is this 100% reproducible for you? 
> 
> Do you see any interesting messages about asserts on the terminal if you
> start Krita from there? Do you get a backtrace if you run Krita in GDB?

I use the appimage so I can't get the backlog, it's a bit too much work to compile it locally. I attached a video with the exact steps and maybe there's other differences in the new file created by me. I'm not sure. Anyway, yes, following these steps it crashes 100% of the time on my PC with SIGSEGV.
Comment 4 Razvan Radulescu 2022-09-18 09:49:03 UTC
I don't know if this helps or not, but this is the run with GDB, I didn't know it outputs more stuff even with the appimage...

❯ gdb ./krita-5.1.1-4126e6dde4-x86_64.appimage 
GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./krita-5.1.1-4126e6dde4-x86_64.appimage...
(No debugging symbols found in ./krita-5.1.1-4126e6dde4-x86_64.appimage)
(gdb) r
Starting program: /home/razcore-rad/Downloads/krita-5.1.1-4126e6dde4-x86_64.appimage 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after fork from child process 139098]
process 139056 is executing new program: /tmp/.mount_krita-eEYXdU/AppRun
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
process 139056 is executing new program: /tmp/.mount_krita-eEYXdU/usr/bin/krita
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe31ff640 (LWP 139103)]
[New Thread 0x7fffe29fe640 (LWP 139104)]
[Thread 0x7fffe31ff640 (LWP 139103) exited]
[New Thread 0x7fffe31ff640 (LWP 139106)]
[Thread 0x7fffe31ff640 (LWP 139106) exited]
[New Thread 0x7fffe31ff640 (LWP 139107)]
[Thread 0x7fffe31ff640 (LWP 139107) exited]
[New Thread 0x7fffe31ff640 (LWP 139108)]
[New Thread 0x7fffb31ff640 (LWP 139109)]
QObject::startTimer: Timers cannot have negative intervals
[Detaching after fork from child process 139110]
[New Thread 0x7fffb29fe640 (LWP 139118)]
[New Thread 0x7fffb21fd640 (LWP 139119)]
[Thread 0x7fffb29fe640 (LWP 139118) exited]
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
/tmp/.mount_krita-eEYXdU/usr/lib/krita-python-libs/krita added to PYTHONPATH
[New Thread 0x7fffb29fe640 (LWP 139126)]
[New Thread 0x7fff9a3ff640 (LWP 139127)]
qt.svg: Cannot open file '/:16_dark_tab-close.svg', because: No such file or directory
qt.svg: Cannot open file '/:16_dark_tab-close.svg', because: No such file or directory
[New Thread 0x7fff99bfe640 (LWP 139128)]
[New Thread 0x7fff993fd640 (LWP 139129)]
[New Thread 0x7fff8bfff640 (LWP 139130)]
[New Thread 0x7fff8a999640 (LWP 139131)]
[New Thread 0x7fff8b7fe640 (LWP 139139)]
[New Thread 0x7fff8a198640 (LWP 139140)]
[New Thread 0x7fff89997640 (LWP 139141)]
[New Thread 0x7fff89196640 (LWP 139142)]
[New Thread 0x7fff88995640 (LWP 139143)]
[New Thread 0x7fff67fff640 (LWP 139144)]
[New Thread 0x7fff677fe640 (LWP 139145)]
[New Thread 0x7fff66ffd640 (LWP 139146)]
[New Thread 0x7fff667fc640 (LWP 139147)]
[New Thread 0x7fff65ffb640 (LWP 139148)]
[New Thread 0x7fff657fa640 (LWP 139149)]
[New Thread 0x7fff64ff9640 (LWP 139150)]
[New Thread 0x7fff47bff640 (LWP 139168)]

Thread 1 "krita" received signal SIGSEGV, Segmentation fault.
0x00007ffff67e5220 in KisNode::graphListener() const () from /tmp/.mount_krita-eEYXdU/usr/bin/../lib/libkritaimage.so.18
Comment 5 Halla Rempt 2022-09-18 09:51:44 UTC
Could you type "thread apply 1 bt" in the gdb window to get more of the backtrace? I still cannot reproduce this, so it might be worth trying this with a clean config/share folder, too. (Make backups, though, of .config/krita* and .local/share/krita*.)
Comment 6 Razvan Radulescu 2022-09-18 10:09:58 UTC
(In reply to Halla Rempt from comment #5)
> Could you type "thread apply 1 bt" in the gdb window to get more of the
> backtrace? I still cannot reproduce this, so it might be worth trying this
> with a clean config/share folder, too. (Make backups, though, of
> .config/krita* and .local/share/krita*.)

So this run is with fresh `~/.config/krita*` & `~/.local/share/krita` files and folders.

❯ gdb ./krita-5.1.1-4126e6dde4-x86_64.appimage
GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./krita-5.1.1-4126e6dde4-x86_64.appimage...
(No debugging symbols found in ./krita-5.1.1-4126e6dde4-x86_64.appimage)
(gdb) r
Starting program: /home/razcore-rad/Downloads/krita-5.1.1-4126e6dde4-x86_64.appimage 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after fork from child process 141515]
process 141472 is executing new program: /tmp/.mount_krita-kF1Bf2/AppRun
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
process 141472 is executing new program: /tmp/.mount_krita-kF1Bf2/usr/bin/krita
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe31ff640 (LWP 141522)]
[New Thread 0x7fffe29fe640 (LWP 141523)]
[Thread 0x7fffe31ff640 (LWP 141522) exited]
[New Thread 0x7fffe31ff640 (LWP 141525)]
[Thread 0x7fffe31ff640 (LWP 141525) exited]
[New Thread 0x7fffe31ff640 (LWP 141526)]
[Thread 0x7fffe31ff640 (LWP 141526) exited]
[New Thread 0x7fffe31ff640 (LWP 141527)]
krita.lib.resources: Created table "version_information"
krita.lib.resources: Created table "storage_types"
krita.lib.resources: Created table "resource_types"
krita.lib.resources: Created table "storages"
krita.lib.resources: Created table "tags"
krita.lib.resources: Created table "resources"
krita.lib.resources: Created table "versioned_resources"
krita.lib.resources: Created table "resource_tags"
krita.lib.resources: Created table "metadata"
krita.lib.resources: Created table "tags_storages"
krita.lib.resources: Created table "tag_translations"
krita.lib.resources: Created table "storages"
krita.lib.resources: Created table "versioned_resources"
krita.lib.resources: Created table "tags"
krita.lib.resources: Created table "resources"
krita.lib.resources: Created table "tag_translations"
krita.lib.resources: Created table "resource_tags"
krita.lib.resources: Created table "resources_signature"
krita.lib.resources: Filled lookup table storage_types
krita.lib.resources: Filled lookup table resource_types
krita.lib.resources: Filled version table
[New Thread 0x7fffb31ff640 (LWP 141531)]
QObject::startTimer: Timers cannot have negative intervals
[New Thread 0x7fffb29fe640 (LWP 141532)]
[New Thread 0x7fffb21fd640 (LWP 141533)]
[Thread 0x7fffb29fe640 (LWP 141532) exited]
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
/tmp/.mount_krita-kF1Bf2/usr/lib/krita-python-libs/krita added to PYTHONPATH
[New Thread 0x7fffb29fe640 (LWP 141536)]
[New Thread 0x7fff9a3ff640 (LWP 141537)]
qt.qpa.xkeyboard: QXcbKeyboard::handleKeyEvent: key pressed, but it is already present in the registry code 64 qtcode 16777251 registered qtcode 16777251
[New Thread 0x7fff9948d640 (LWP 141552)]
[New Thread 0x7fff98c8c640 (LWP 141553)]
[New Thread 0x7fff8bfff640 (LWP 141554)]
[New Thread 0x7fff8b7fe640 (LWP 141555)]
[New Thread 0x7fff8affd640 (LWP 141556)]
[New Thread 0x7fff8a7fc640 (LWP 141557)]
[New Thread 0x7fff89ffb640 (LWP 141558)]
[New Thread 0x7fff897fa640 (LWP 141559)]
[New Thread 0x7fff88ff9640 (LWP 141560)]
[New Thread 0x7fff63fff640 (LWP 141561)]
[New Thread 0x7fff6bfff640 (LWP 141562)]
[New Thread 0x7fff6b7fe640 (LWP 141563)]
[New Thread 0x7fff4bffd640 (LWP 141577)]

Thread 1 "krita" received signal SIGSEGV, Segmentation fault.
0x00007ffff67e5220 in KisNode::graphListener() const () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaimage.so.18
(gdb) thread apply 1 bt

Thread 1 (Thread 0x7ffff6338800 (LWP 141472) "krita"):
#0  0x00007ffff67e5220 in KisNode::graphListener() const () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaimage.so.18
#1  0x00007ffff676c06a in ?? () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaimage.so.18
#2  0x00007ffff67656a5 in KisImage::~KisImage() () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaimage.so.18
#3  0x00007ffff6765779 in KisImage::~KisImage() () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaimage.so.18
#4  0x00007ffff67e6db0 in ?? () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaimage.so.18
#5  0x00007ffff67e82db in KisNode::setImage(KisWeakSharedPtr<KisImage>) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaimage.so.18
#6  0x00007ffff678570c in KisLayer::setImage(KisWeakSharedPtr<KisImage>) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaimage.so.18
#7  0x00007ffff674d57c in KisGroupLayer::setImage(KisWeakSharedPtr<KisImage>) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaimage.so.18
#8  0x00007ffff6763023 in KisImage::copyFromImageImpl(KisImage const&, int) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaimage.so.18
#9  0x00007ffff676554b in KisImage::KisImage(KisImage const&, KisUndoStore*, bool) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaimage.so.18
#10 0x00007ffff6765606 in KisImage::clone(bool) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaimage.so.18
#11 0x00007ffff7967c98 in KisDocument::copyFromDocumentImpl(KisDocument const&, KisDocument::CopyPolicy) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaui.so.18
#12 0x00007ffff79686b5 in KisDocument::KisDocument(KisDocument const&, bool) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaui.so.18
#13 0x00007ffff796c392 in ?? () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaui.so.18
#14 0x00007ffff796ca55 in KisDocument::initiateSavingInBackground(QString, QObject const*, char const*, KritaUtils::ExportFileJob const&, KisPinnedSharedPtr<KisPropertiesConfiguration>, std::unique_ptr<KisDocument, std::default_delete<KisDocument> >&&, bool) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaui.so.18
#15 0x00007ffff796cd84 in KisDocument::initiateSavingInBackground(QString, QObject const*, char const*, KritaUtils::ExportFileJob const&, KisPinnedSharedPtr<KisPropertiesConfiguration>, bool) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaui.so.18
#16 0x00007ffff796cfc2 in KisDocument::exportDocumentImpl(KritaUtils::ExportFileJob const&, KisPinnedSharedPtr<KisPropertiesConfiguration>, bool) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaui.so.18
#17 0x00007ffff796f426 in KisDocument::saveAs(QString const&, QByteArray const&, bool, KisPinnedSharedPtr<KisPropertiesConfiguration>) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaui.so.18
#18 0x00007ffff799458d in KisMainWindow::saveDocument(KisDocument*, bool, bool, bool) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaui.so.18
#19 0x00007ffff79951c6 in KisMainWindow::slotFileSaveAs() () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaui.so.18
#20 0x00007ffff486d575 in QMetaObject::activate(QObject*, int, int, void**) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Core.so.5
#21 0x00007ffff52e7712 in QAction::triggered(bool) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Widgets.so.5
#22 0x00007ffff52e9d3c in QAction::activate(QAction::ActionEvent) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Widgets.so.5
#23 0x00007ffff52ea6a1 in QAction::event(QEvent*) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Widgets.so.5
#24 0x00007ffff52ede4c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Widgets.so.5
#25 0x00007ffff52f5360 in QApplication::notify(QObject*, QEvent*) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Widgets.so.5
#26 0x00007ffff7951fae in KisApplication::notify(QObject*, QEvent*) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libkritaui.so.18
#27 0x00007ffff483da28 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Core.so.5
#28 0x00007ffff4ce14e2 in QShortcutMap::dispatchEvent(QKeyEvent*) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Gui.so.5
#29 0x00007ffff4ce15aa in QShortcutMap::tryShortcut(QKeyEvent*) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Gui.so.5
#30 0x00007ffff4c94a16 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Gui.so.5
#31 0x00007ffff4cb2cb7 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Gui.so.5
#32 0x00007ffff4cb7845 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Gui.so.5
#33 0x00007ffff4c9110b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Gui.so.5
#34 0x00007ffff38ef34a in ?? () from /tmp/.mount_krita-kF1Bf2/usr/plugins/platforms/../../lib/libQt5XcbQpa.so.5
--Type <RET> for more, q to quit, c to continue without paging--c
#35 0x00007fffebc4c537 in g_main_context_dispatch () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libglib-2.0.so.0
#36 0x00007fffebc4c770 in ?? () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libglib-2.0.so.0
#37 0x00007fffebc4c7fc in g_main_context_iteration () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libglib-2.0.so.0
#38 0x00007ffff489abaf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Core.so.5
#39 0x00007ffff483bc5a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Core.so.5
#40 0x00007ffff4844e80 in QCoreApplication::exec() () from /tmp/.mount_krita-kF1Bf2/usr/bin/../lib/libQt5Core.so.5
#41 0x0000555555408626 in main ()
Comment 7 Halla Rempt 2022-09-18 10:34:42 UTC
Thanks! I still cannot reproduce this, but I'll discuss this issue during the meeting tomorrow. Maybe other people have a clue what might be going on...
Comment 8 Halla Rempt 2022-09-19 03:00:29 UTC
*** Bug 459365 has been marked as a duplicate of this bug. ***
Comment 9 Halla Rempt 2022-09-19 03:37:22 UTC
Freya says this is the breaking commit:

https://invent.kde.org/graphics/krita/-/commit/ed757644f27d4f1507b5e8c294b48529545a85cf

Dmitry, please take a look?
Comment 10 Dmitry Kazakov 2022-09-19 12:50:22 UTC
Git commit 29cb917984e030607d908b40fb63c47003aa5980 by Dmitry Kazakov.
Committed on 19/09/2022 at 12:50.
Pushed by dkazakov into branch 'master'.

Fix a crash when trying to save an image with a fill layer

M  +0    -2    libs/image/kis_selection_based_layer.cpp

https://invent.kde.org/graphics/krita/commit/29cb917984e030607d908b40fb63c47003aa5980
Comment 11 Dmitry Kazakov 2022-09-19 12:50:49 UTC
Git commit de6a3701a83266130c7b766a6eaef7753ad02eb6 by Dmitry Kazakov.
Committed on 19/09/2022 at 12:50.
Pushed by dkazakov into branch 'krita/5.1'.

Fix a crash when trying to save an image with a fill layer


(cherry picked from commit 29cb917984e030607d908b40fb63c47003aa5980)

M  +0    -2    libs/image/kis_selection_based_layer.cpp

https://invent.kde.org/graphics/krita/commit/de6a3701a83266130c7b766a6eaef7753ad02eb6
Comment 12 Halla Rempt 2022-09-20 10:46:13 UTC
*** Bug 459436 has been marked as a duplicate of this bug. ***