Bug 376382 - Krita crashes when drag and drop layer group with blur mask on it
Summary: Krita crashes when drag and drop layer group with blur mask on it
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 3.1.1
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-12 04:34 UTC by katearcher89
Modified: 2017-04-18 10:36 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description katearcher89 2017-02-12 04:34:45 UTC
When trying to drag and drop a group of layers with a filter mask applied to it(lens blur to be more speciffic) from one window to another krita crashes.

Steps to reproduce:
1. Create two files(I've created two 7k to 9k files with one white layer at start)
2. Create a group with two layers in it and draw anything in each layer.
3. Apply a filter mask to a group(lens blur with radius 40 in my case)
4. Drag and drop this group from your current window to the second window/file, created earlier.
5. Krita crashes in 100% of cases(sometimes instantly, sometimes after some seconds of trying to render the group in new window).

Expected: The group should be just dropped, no crashes.
Comment 1 katearcher89 2017-02-12 04:37:36 UTC
oh, the specs: win7sp3, gtx965m, i7, 16gb
Comment 2 Halla Rempt 2017-02-12 08:14:25 UTC
Could you please follow these instructions: 

https://docs.krita.org/Dr._Mingw_debugger

And add a backtrace?
Comment 3 Bruno P. Kinoshita 2017-03-24 08:20:44 UTC
Very detailed steps! Made it easier to try to reproduce it.

It works with no crash on Linux:

* Qt 5.6.2
* Ubuntu 16.04.2 LTS

Hope that helps
Bruno
Comment 4 Halla Rempt 2017-03-24 11:57:42 UTC
I suspect Kate's computer may be running out of memory. I've just tried to reproduce, and didn't get a crash, though I did see

Error std::bad_alloc sending event 63 to object 

In the output. I still need a crash log.
Comment 5 Bruno P. Kinoshita 2017-03-25 22:05:11 UTC
I think you are right Boudewijn.

Here's how I (think I) reproduced it.

1. Play a while reproducing the issue, looking at top or htop to look at the memory and virtual memory numbers.
2. Guess the amount of virtual memory you will need (memory should be fine, krita won't allocate much)
3. Limit the current session memory through ulimit
4. Follow the reporter's steps to reproduce the issue
5. Segmentation fault

In the console output, I can see

    Error std::bad_alloc sending event 63 to object qt_scrollarea_viewport
    Segmentation fault

Running in gdb, the following is displayed when the crash happens:

    Thread 1 "krita" received signal SIGSEGV, Segmentation fault.
    KoToolManager::activeCanvasController (this=0x0) at /home/kinow/Development/cpp/workspace/krita/libs/flake/KoToolManager.cpp:369
    369	    if (! d->canvasData) return 0;

FWIW, here's my script with the settings used to reproduce it

    # 2550 mb in kb
    ulimit -v 2550000
    
    # 2 mb in kb
    ulimit -m 2000000
    
    # Confirm limits
    ulimit -a
    
    gdb $HOME/Development/cpp/workspace/krita_install/bin/krita

And here's my backtrace.

#0  KoToolManager::activeCanvasController (this=0x0) at /home/kinow/Development/cpp/workspace/krita/libs/flake/KoToolManager.cpp:369
#1  0x00007ffff764297e in KisNodeShape::~KisNodeShape (this=0x7b53330, __in_chrg=<optimized out>)
    at /home/kinow/Development/cpp/workspace/krita/libs/ui/flake/kis_node_shape.cpp:62
#2  0x00007ffff7642a79 in KisNodeShape::~KisNodeShape (this=0x7b53330, __in_chrg=<optimized out>)
    at /home/kinow/Development/cpp/workspace/krita/libs/ui/flake/kis_node_shape.cpp:72
#3  0x00007ffff76427ab in KisNodeShapesGraph::removeNode (this=<optimized out>, node=...)
    at /home/kinow/Development/cpp/workspace/krita/libs/ui/flake/kis_node_shapes_graph.cpp:71
#4  0x00007ffff7643bc6 in KisShapeController::~KisShapeController (this=0x7acf470, __in_chrg=<optimized out>)
    at /home/kinow/Development/cpp/workspace/krita/libs/ui/flake/kis_shape_controller.cpp:83
#5  0x00007ffff7644209 in KisShapeController::~KisShapeController (this=0x7acf470, __in_chrg=<optimized out>)
    at /home/kinow/Development/cpp/workspace/krita/libs/ui/flake/kis_shape_controller.cpp:87
#6  0x00007ffff78c8146 in KisDocument::~KisDocument (this=0x7ae6f20, __in_chrg=<optimized out>) at /home/kinow/Development/cpp/workspace/krita/libs/ui/KisDocument.cpp:483
#7  0x00007ffff78c8549 in KisDocument::~KisDocument (this=0x7ae6f20, __in_chrg=<optimized out>) at /home/kinow/Development/cpp/workspace/krita/libs/ui/KisDocument.cpp:520
#8  0x00007ffff7906e04 in KisPart::~KisPart (this=0x7ffff7dd55b0 <_ZZN12_GLOBAL__N_116Q_QGS_s_instance13innerFunctionEvE6holder>, __in_chrg=<optimized out>)
    at /home/kinow/Development/cpp/workspace/krita/libs/ui/KisPart.cpp:141
#9  0x00007ffff7907129 in (anonymous namespace)::Q_QGS_s_instance::Holder::~Holder (this=<optimized out>, __in_chrg=<optimized out>)
    at /home/kinow/Development/cpp/workspace/krita/libs/ui/KisPart.cpp:80
#10 0x00007ffff4d34ff8 in __run_exit_handlers (status=1, listp=0x7ffff50be5f8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82
#11 0x00007ffff4d35045 in __GI_exit (status=<optimized out>) at exit.c:104
#12 0x00007fffd97a24f1 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#13 0x00007fffd97b063d in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#14 0x00007fffeddeb7bc in ?? () from /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
#15 0x00007fffe27c6522 in ?? () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so
#16 0x00007ffff5eaa869 in QOpenGLContext::swapBuffers(QSurface*) () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Gui.so.5
#17 0x00007ffff6143b7b in ?? () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Gui.so.5
#18 0x00007ffff614432b in QPlatformBackingStore::composeAndFlush(QWindow*, QRegion const&, QPoint const&, QPlatformTextureList*, QOpenGLContext*, bool) ()
   from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Gui.so.5
#19 0x00007fffe4bbbde7 in ?? () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/plugins/platforms/../../lib/libQt5XcbQpa.so.5
#20 0x00007ffff66cbf3f in ?? () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5
#21 0x00007ffff66cce98 in ?? () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5
#22 0x00007ffff66ce5a5 in ?? () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5
#23 0x00007ffff66cf009 in ?? () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5
#24 0x00007ffff66efbaf in QWidgetPrivate::syncBackingStore() () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5
#25 0x00007ffff6705340 in QWidget::event(QEvent*) () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5
#26 0x00007ffff68195cb in QMainWindow::event(QEvent*) () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5
#27 0x00007ffff70fdc9a in KMainWindow::event (this=this@entry=0xbc7d940, ev=ev@entry=0x7fff93ec04e0)
    at /home/kinow/Development/cpp/workspace/krita/libs/widgetutils/xmlgui/kmainwindow.cpp:780
#28 0x00007ffff713f159 in KXmlGuiWindow::event (this=0xbc7d940, ev=0x7fff93ec04e0)
    at /home/kinow/Development/cpp/workspace/krita/libs/widgetutils/xmlgui/kxmlguiwindow.cpp:125
#29 0x00007ffff66c1f3c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5
#30 0x00007ffff66c62a0 in QApplication::notify(QObject*, QEvent*) () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5
#31 0x00007ffff78baad7 in KisApplication::notify (this=<optimized out>, receiver=0xbc7d940, event=0x7fff93ec04e0)
    at /home/kinow/Development/cpp/workspace/krita/libs/ui/KisApplication.cpp:542
#32 0x00007ffff58d0720 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Core.so.5
#33 0x00007ffff58d2f13 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Core.so.5
#34 0x00007ffff591fb13 in ?? () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Core.so.5
#35 0x00007fffee273197 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#36 0x00007fffee2733f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#37 0x00007fffee27349c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#38 0x00007ffff591ff07 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Core.so.5
#39 0x00007ffff58ce76a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Core.so.5
#40 0x00007ffff58d65fd in QCoreApplication::exec() () from /home/kinow/Development/cpp/Qt/5.6/gcc_64/lib/libQt5Core.so.5
#41 0x00000000004051e5 in main (argc=1, argv=<optimized out>) at /home/kinow/Development/cpp/workspace/krita/krita/main.cc:269

Hope that helps
Bruno
Comment 6 Halla Rempt 2017-03-27 13:58:02 UTC
Thanks for the backtrace! It doesn't look like out-of-memory, actually, but a timing related issue (that probably happens more often when there isn't enough memory).
Comment 7 Bruno P. Kinoshita 2017-03-27 20:46:56 UTC
Not a problem Boudewijn. Sounds interesting. Will keep an eye for the commit diff to learn how to fix this kind of problems. Guess I'm not able to produce a patch for it at the moment, but hopefully with some practice and reading the code base a bit more :)

Thanks
Bruno
Comment 8 Dmitry Kazakov 2017-03-29 14:33:49 UTC
Well, I didn't manage to reproduce the crash. Neither on Linux nor on Windows :(
The fact that Kate has 16GiB of RAM makes the OOM not very probable.
Comment 9 Bruno P. Kinoshita 2017-03-30 01:04:55 UTC
FWIW, when I reduced the memory settings to 1 GB, it would still work, but then I noticed the virtual memory in htop, and after reducing the virtual memory the issue happened.

Maybe she has 16 gb but her virtual memory settings caused this issue? Might be possible to test with ulimit -v depending on your environment I think.

Cheers
Bruno
Comment 10 Dmitry Kazakov 2017-04-10 14:40:35 UTC
Heh... I just checked... the crash Boud and Bruno has happens most probably dues to the "clone-image-on-saved-disabled" patch. KraExport::convert() accesses KisDocument::savingImage() and checks it with Q_CHECK_PTR instead of KIS_ASSERS, which emit an exception.
Comment 11 Halla Rempt 2017-04-11 08:15:36 UTC
I am not sure I follow that logic... Shouldn't that assert for everyone then? Plus, savingImage() returns the actual image, the pointer should be valid.
Comment 12 Dmitry Kazakov 2017-04-11 09:29:08 UTC
Git commit a616f6af271a4cc9f33cdd793d98a6d8cc2f5001 by Dmitry Kazakov.
Committed on 11/04/2017 at 09:28.
Pushed by dkazakov into branch 'master'.

Fix at least one crash when D&D layers from one huge image to another

M  +22   -0    libs/ui/KisDocument.cpp
M  +7    -0    libs/ui/KisDocument.h
M  +2    -13   libs/ui/kis_mimedata.cpp
M  +1    -1    plugins/impex/kra/kra_export.cpp

https://commits.kde.org/krita/a616f6af271a4cc9f33cdd793d98a6d8cc2f5001
Comment 13 Dmitry Kazakov 2017-04-11 09:29:08 UTC
Git commit 2911af8cee02c9b280f149e0597f61b0fd141145 by Dmitry Kazakov.
Committed on 11/04/2017 at 09:28.
Pushed by dkazakov into branch 'master'.

Implement blocking the source image when D&D nodes
Ref T5753

M  +39   -5    libs/image/kis_image_barrier_locker.h
M  +3    -2    libs/ui/kis_clipboard.cc
M  +2    -1    libs/ui/kis_clipboard.h
M  +37   -26   libs/ui/kis_mimedata.cpp
M  +5    -5    libs/ui/kis_mimedata.h
M  +2    -5    libs/ui/kis_node_manager.cpp
M  +1    -1    libs/ui/kis_node_model.cpp

https://commits.kde.org/krita/2911af8cee02c9b280f149e0597f61b0fd141145
Comment 14 Dmitry Kazakov 2017-04-11 09:29:09 UTC
Git commit 77fdd9896492e9a94f147ae559903181f3112d96 by Dmitry Kazakov.
Committed on 11/04/2017 at 09:28.
Pushed by dkazakov into branch 'master'.

Add user feedback when locking for D&D between images

M  +1    -0    libs/ui/CMakeLists.txt
A  +40   -0    libs/ui/KisImageBarrierLockerWithFeedback.cpp     [License: GPL (v2+)]
A  +49   -0    libs/ui/KisImageBarrierLockerWithFeedback.h     [License: GPL (v2+)]
M  +4    -4    libs/ui/kis_mimedata.cpp

https://commits.kde.org/krita/77fdd9896492e9a94f147ae559903181f3112d96
Comment 15 Dmitry Kazakov 2017-04-18 10:36:56 UTC
Git commit 6df9e3b2350dcb93b662dac512696d1625b27b06 by Dmitry Kazakov.
Committed on 18/04/2017 at 10:36.
Pushed by dkazakov into branch 'krita/3.1'.

Add user feedback when locking for D&D between images

M  +1    -0    libs/ui/CMakeLists.txt
A  +40   -0    libs/ui/KisImageBarrierLockerWithFeedback.cpp     [License: GPL (v2+)]
A  +49   -0    libs/ui/KisImageBarrierLockerWithFeedback.h     [License: GPL (v2+)]
M  +4    -3    libs/ui/kis_mimedata.cpp

https://commits.kde.org/krita/6df9e3b2350dcb93b662dac512696d1625b27b06
Comment 16 Dmitry Kazakov 2017-04-18 10:36:56 UTC
Git commit a0adcab1fd9400dbd863d4e0cf04845c45859c46 by Dmitry Kazakov.
Committed on 18/04/2017 at 10:36.
Pushed by dkazakov into branch 'krita/3.1'.

Fix at least one crash when D&D layers from one huge image to another

M  +29   -6    libs/ui/KisDocument.cpp
M  +7    -0    libs/ui/KisDocument.h
M  +2    -11   libs/ui/kis_mimedata.cpp

https://commits.kde.org/krita/a0adcab1fd9400dbd863d4e0cf04845c45859c46
Comment 17 Dmitry Kazakov 2017-04-18 10:36:56 UTC
Git commit 161aa6e42265d7c161aadc95986ae74b4d6d3ab8 by Dmitry Kazakov.
Committed on 18/04/2017 at 10:36.
Pushed by dkazakov into branch 'krita/3.1'.

Implement blocking the source image when D&D nodes
Ref T5753

M  +39   -5    libs/image/kis_image_barrier_locker.h
M  +3    -2    libs/ui/kis_clipboard.cc
M  +2    -1    libs/ui/kis_clipboard.h
M  +37   -26   libs/ui/kis_mimedata.cpp
M  +5    -5    libs/ui/kis_mimedata.h
M  +2    -5    libs/ui/kis_node_manager.cpp
M  +1    -1    libs/ui/kis_node_model.cpp

https://commits.kde.org/krita/161aa6e42265d7c161aadc95986ae74b4d6d3ab8