Bug 345707 - G'MIC 1.6.1.0 .- Krita 2.9.1: crash with montage filter
Summary: G'MIC 1.6.1.0 .- Krita 2.9.1: crash with montage filter
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: G'Mic for Krita (show other bugs)
Version: 2.9.1
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: LukasT
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-30 23:02 UTC by Silvio Grosso
Modified: 2015-08-07 11:08 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
attachment-10109-0.html (1.93 KB, text/html)
2015-07-11 14:29 UTC, Silvio Grosso
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Silvio Grosso 2015-03-30 23:02:26 UTC
Krita 2.9.1 updated through the ppa by Dmitry
Kubuntu 14.10 - KDE desktop
G'MIC 1.6.1.0

Reproducible: Sometimes

Steps to Reproduce:
1. Fire ups Krita 2.9.1 (ppa by Dmitry) and create a new white layer;
2. Import 6 layers (jpeg images around 100-200 Kb each);
3. Run the G'mic plugin and select Array & Tiles > Montage;
4. Options for this Montage filters are: All layers - Custom Filter (in order to manually choose how to place yours layers)
5. As soon as you click Ok (most of the time) Krita usually crashes.

I attach my Backtrace:
https://dl.dropboxusercontent.com/u/3095134/BUGS_REPORT/KRITA_2.9/backtrace_crash_montage.txt

I have recorded all my steps until the final crash:
https://dl.dropboxusercontent.com/u/3095134/BUGS_REPORT/KRITA_2.9/GMIC_MONTAGE_FILTER_CRASH.mp4

Actual Results:  
Krita 2.9.1 crashes with the G'MIC filter > Montage
The problem looks like related to not enough RAM - Memory to handle this specific filter.

Expected Results:  
Krita 2.9.1 should not crash with the G'MIC - Montage filter.

With Gimp 2.8.14 (Windows 7) this same filter needs a LOT of memory to run smoothly.
In addition, It is very important not to use big jpeg-png images as layers (in order not to stress your Ram) :-)

BTW, currently this filter is not useful with Krita because you can not create a new layer as output... :-)
I have only tested it with Krita 2.9.1 because I have thought it was likely to crash Krita...
Comment 1 Halla Rempt 2015-04-08 09:23:38 UTC
Lukas, can you take a look at this one?
Comment 2 LukasT 2015-04-11 17:28:37 UTC
Sure! I'm on it!
Comment 3 Halla Rempt 2015-05-27 07:50:36 UTC
Looks like it's fixed, isn't it? At least, I cannot reproduce anymore :-)
Comment 4 Silvio Grosso 2015-05-27 18:11:11 UTC
You can close this ticket :-)
It does not crash anymore (just tested on Windows 7 - 64 bit).
Comment 5 Silvio Grosso 2015-05-27 18:39:37 UTC
I stand corrected :-(

Actually, this G'MIC filter (Montage) still crashes on Windows 7 (64 bit) with the latest Krita 2.9.4 (latest version from Kickstarter).
It even always crashes with the previous, last week, .exe version of Krita 2.9.4 from Kickstarter (therefore, it is not a regression regarding the latest version).
I have tried with very small images as size and Krita always crashes.

Just recorded a video with all my steps to always crash Krita 2.9.4 (ZIP version):
https://dl.dropboxusercontent.com/u/3095134/BUGS_REPORT/KRITA_2.9/KRITA_2.9.4_MONTAGE_FILTER_CRASH2.avi
Comment 6 Silvio Grosso 2015-05-27 19:08:40 UTC
Just got the backtrace for this crash (same 4 jpeg images tried on Windows 7 - 64 bit) on Linux as well (Xubuntu 15.04 - 64 bit with Krita 2.9.3 by Dmitry's Lime Package):

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5ce98c1 in QTimer::start() ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
(gdb) thread apply all bt

Thread 55 (Thread 0x7fffc2bfc700 (LWP 9616)):
#0  clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:81
#1  0x00007fffefa4d0c0 in ?? () at pthread_create.c:174
   from /lib/x86_64-linux-gnu/libpthread.so.0
#2  0x00007fffc2bfc700 in ?? ()
#3  0x0000000000000000 in ?? ()

Thread 54 (Thread 0x7fffc897a700 (LWP 9615)):
#0  float2int (x=255)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/libs/pigment/KoColorSpaceMaths.h:194
#1  scaleToA (a=1)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/libs/pigment/KoColorSpaceMaths.h:355
#2  KisColorFromFloat<unsigned char, KoBgrTraits<unsigned char> >::transform (
    this=<optimized out>, src=<optimized out>, dst=<optimized out>, nPixels=30)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/plugins/extensions/gmic/kis_gmic_simple_convertor.cpp:85
#3  0x00007fffc1524eb4 in KisGmicSimpleConvertor::convertFromGmicFast (
    gmicImage=..., dst=..., gmicUnitValue=gmicUnitValue@entry=255)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/plugins/extensions/gmic/kis_gmic_simple_convertor.cpp:374
---Type <return> to continue, or q <return> to quit---
#4  0x00007fffc159ecf0 in KisImportGmicProcessingVisitor::gmicImageToPaintDevice (srcGmicImage=..., dst=..., selection=..., dstRect=...)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/plugins/extensions/gmic/kis_import_gmic_processing_visitor.cpp:81
#5  0x00007fffc159ff04 in KisImportGmicProcessingVisitor::visitNodeWithPaintDevice (this=0x58c1410, node=0x248f1e0, undoAdapter=0x58c14b0)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/plugins/extensions/gmic/kis_import_gmic_processing_visitor.cpp:59
#6  0x00007ffff430e5ee in KisProcessingCommand::redo (this=0x58c1470)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/image/commands_new/kis_processing_command.cpp:35
#7  0x00007ffff43cfd8e in KisStrokeStrategyUndoCommandBased::doStrokeCallback (
    this=0x24b0200, data=<optimized out>)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/image/kis_stroke_strategy_undo_command_based.cpp:96
#8  0x00007ffff426c61c in KisUpdateJobItem::run (this=0x2047bf0)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/obj-x86_64-linux-gnu/krita/image/../../../krita/image/kis_update_job_item.h:61
#9  0x00007ffff5bbdfee in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#10 0x00007ffff5bca32f in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#11 0x00007fffefa4d182 in start_thread (arg=0x7fffc897a700)
    at pthread_create.c:312
#12 0x00007ffff536a47d in clone ()
---Type <return> to continue, or q <return> to quit---
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 12 (Thread 0x7fffc3fff700 (LWP 9572)):
#0  0x00007ffff535d12d in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007fffef56dfe4 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fffef56e0ec in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff5cf97be in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007ffff5ccb0af in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00007ffff5ccb3a5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007ffff5bc7c5f in QThread::exec() ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7  0x00007ffff5cac823 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#8  0x00007ffff5bca32f in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#9  0x00007fffefa4d182 in start_thread (arg=0x7fffc3fff700)
    at pthread_create.c:312
#10 0x00007ffff536a47d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 11 (Thread 0x7fffc37fe700 (LWP 9571)):
---Type <return> to continue, or q <return> to quit---
#0  pthread_cond_wait@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007ffff5bca816 in QWaitCondition::wait(QMutex*, unsigned long) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007ffff6b9bd96 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#3  0x00007ffff5bca32f in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007fffefa4d182 in start_thread (arg=0x7fffc37fe700)
    at pthread_create.c:312
#5  0x00007ffff536a47d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 10 (Thread 0x7fffc917b700 (LWP 9570)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00007ffff5bc8f4a in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007ffff5bc976d in QThread::msleep(unsigned long) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007ffff429cbba in KisTileDataSwapper::run (this=0x168d558)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:97
#4  0x00007ffff5bca32f in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00007fffefa4d182 in start_thread (arg=0x7fffc917b700)
    at pthread_create.c:312
---Type <return> to continue, or q <return> to quit---
#6  0x00007ffff536a47d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 9 (Thread 0x7fffc997c700 (LWP 9569)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00007ffff5bca7f4 in QWaitCondition::wait(QMutex*, unsigned long) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007ffff5bc6cef in QSemaphore::tryAcquire(int, int) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007ffff42745d2 in waitForWork (this=0x168d520)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/image/tiles3/kis_tile_data_pooler.cc:160
#4  KisTileDataPooler::run (this=0x168d520)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/image/tiles3/kis_tile_data_pooler.cc:184
#5  0x00007ffff5bca32f in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007fffefa4d182 in start_thread (arg=0x7fffc997c700)
    at pthread_create.c:312
#7  0x00007ffff536a47d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 1 (Thread 0x7ffff7fb57c0 (LWP 9558)):
---Type <return> to continue, or q <return> to quit---
#0  0x00007ffff5ce98c1 in QTimer::start() ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#1  0x00007fffc15a1669 in KisGmicProgressManager::initProgress (this=0x0)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/plugins/extensions/gmic/kis_gmic_progress_manager.cpp:42
#2  0x00007fffc15acd88 in KisGmicPlugin::createViewportPreview (
    this=this@entry=0x1a9c750, layers=..., setting=setting@entry=0x58bddb0)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/plugins/extensions/gmic/kis_gmic_plugin.cpp:389
#3  0x00007fffc15ade04 in KisGmicPlugin::slotPreviewGmicCommand (
    this=this@entry=0x1a9c750, setting=0x58bddb0)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/plugins/extensions/gmic/kis_gmic_plugin.cpp:287
#4  0x00007fffc15af1b0 in KisGmicPlugin::qt_static_metacall (_o=0x1a9c750,
    _c=<optimized out>, _id=4, _a=0x7fffffffd140)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/obj-x86_64-linux-gnu/krita/plugins/extensions/gmic/kis_gmic_plugin.moc:92
#5  0x00007ffff5ce087a in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007fffc1519d02 in KisGmicWidget::sigPreviewFilterCommand (
    this=this@entry=0x5d68020, _t1=0x58bddb0)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/obj-x86_64-linux-gnu/krita/plugins/extensions/gmic/moc_kis_gmic_widget.cpp:162
---Type <return> to continue, or q <return> to quit---
#7  0x00007fffc15d60f8 in requestComputePreview (this=0x5d68020)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/plugins/extensions/gmic/kis_gmic_widget.cpp:391
#8  KisGmicWidget::slotConfigurationChanged (this=0x5d68020)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/plugins/extensions/gmic/kis_gmic_widget.cpp:318
#9  0x00007fffc151a2c8 in KisGmicWidget::qt_static_metacall (_o=0x5d68020,
    _c=<optimized out>, _id=18, _a=0x7fffffffd270)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/obj-x86_64-linux-gnu/krita/plugins/extensions/gmic/moc_kis_gmic_widget.cpp:103
#10 0x00007ffff5ce087a in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#11 0x00007ffff4364950 in KisConfigWidget::sigConfigurationUpdated (
    this=<optimized out>)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/obj-x86_64-linux-gnu/krita/image/kis_config_widget.moc:112
#12 0x00007ffff4364955 in KisConfigWidget::slotConfigChanged (
    this=<optimized out>)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/image/kis_config_widget.cpp:38
#13 0x00007ffff4364e08 in KisConfigWidget::qt_static_metacall (_o=0x3255ea0,
    _c=<optimized out>, _id=4, _a=0x7fffffffd3e0)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/obj-x86_64-linux-gnu/---Type <return> to continue, or q <return> to quit---
krita/image/kis_config_widget.moc:63
#14 0x00007ffff5ce087a in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#15 0x00007ffff5ce4a31 in QObject::event(QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#16 0x00007ffff66bee2c in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#17 0x00007ffff66c54a0 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#18 0x00007ffff7811997 in KisApplication::notify (this=<optimized out>,
    receiver=0x3255ec8, event=0x7fffffffd7f0)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/ui/KisApplication.cpp:489
#19 0x00007ffff5ccc4dd in QCoreApplication::notifyInternal(QObject*, QEvent*)
    () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#20 0x00007ffff5cfc323 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#21 0x00007ffff5cf95f1 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#22 0x00007fffef56de04 in g_main_context_dispatch ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007fffef56e048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007fffef56e0ec in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007ffff5cf97a1 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop:---Type <return> to continue, or q <return> to quit---
:ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#26 0x00007ffff6760bb6 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#27 0x00007ffff5ccb0af in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#28 0x00007ffff5ccb3a5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#29 0x00007ffff5cd0b79 in QCoreApplication::exec() ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#30 0x0000000000402692 in main (argc=<optimized out>, argv=<optimized out>)
    at /build/buildd/krita-testing-2+git20150503+r73250-51/krita/main.cc:179
Comment 7 LukasT 2015-06-06 08:58:23 UTC
How much memory do you have available on your machine? I cannot reproduce it with 8GB Ram.

Montage filter creates huge gmic image, so it might be problem with gmic, but you would be able to reproduce it in gimp for gmic too..Are you able?

There does not seem to be problem in the code in the backtrace..
Comment 8 LukasT 2015-06-06 09:01:12 UTC
Though there is a bug in G'Mic: Montage filter produces bigger layer than the source layer and in GIMP it resizes the image : we don't do it in Krita yet.
Comment 9 Silvio Grosso 2015-06-06 15:05:46 UTC
Hi Lukas,

Just tried today,  with Krita 2.9.4 (zip version) on Windows 7 (64 bit).
As soon as I click Ok on G'MIC, with this filter (montage),  Krita crashes after a few seconds.
The same 4 jpeg images work fine with GIMP 2.8.14 (G'MIC 1.6.31) in that the Montage filter is applied quickly (no crash whatsoever).

My hardware is:
CPU Intel Core(TM) I7 2630QM
8 GB RAM
Nvidia GT540M (GEFORCE)

Here is the link with my 4 jpeg images:
https://dl.dropboxusercontent.com/u/3095134/BUGS_REPORT/KRITA_2.9/MONTAGE_FILTER.zip
Comment 10 LukasT 2015-06-06 19:18:45 UTC
I fixed the problem with resizing in commit
http://commits.kde.org/calligra/9174710d6c86565c0dcfbf873f4e4fb803e32e73

Silvio, can you try to uncheck the checkbox preview under small preview? 
Can you reproduce it with the preview checkbox unchecked?
Comment 11 Silvio Grosso 2015-06-06 19:43:26 UTC
Hi Lukas,

> Can you reproduce it with the preview checkbox unchecked?

Nope (nice cactch indeed )  :-)

In short, with the preview checkbox unchecked Krita does not crash (Windows 7 - 64 bit as usual).
With the preview checked, on the contrary, Krita always crashes as soon as I click Ok (to execute the Montage filter)
Comment 12 LukasT 2015-07-10 13:53:34 UTC
Git commit a1bc6809586d3ad47a7e0461864db683a801518c by Lukáš Tvrdý.
Committed on 10/07/2015 at 13:53.
Pushed by lukast into branch 'calligra/2.9'.

Fix viewport preview generation

Instead of creating new thread per preview request,
use single thread and cancel unfinished preview requests.
If user changes the filter configuration, they are invalid anyway.

Hopefully this solves the problem when user was changing
filter settings quickly by draging sliders here and there.
The UI feels also much more responsive.

Inspiration for this solution was Mandelbrot example from Qt.
This solution uses proper synchronization. Previous implementation
did not synchronize any shared resources, thus it was crashy!

M  +2    -3    krita/plugins/extensions/gmic/kis_gmic_applicator.cpp
M  +45   -49   krita/plugins/extensions/gmic/kis_gmic_plugin.cpp
M  +2    -2    krita/plugins/extensions/gmic/kis_gmic_plugin.h
M  +3    -1    krita/plugins/extensions/gmic/kis_gmic_settings_widget.cpp
M  +132  -49   krita/plugins/extensions/gmic/kis_gmic_small_applicator.cpp
M  +13   -5    krita/plugins/extensions/gmic/kis_gmic_small_applicator.h

http://commits.kde.org/calligra/a1bc6809586d3ad47a7e0461864db683a801518c
Comment 13 Halla Rempt 2015-07-11 08:44:10 UTC
Hi, following Lukas' commit, I've made a new windows build for testing: 

http://files.kde.org/krita/windows/krita_x64_2.9.6.2_gmictest.zip
Comment 14 Silvio Grosso 2015-07-11 14:29:25 UTC
Created attachment 93562 [details]
attachment-10109-0.html

Hi Boud,
Thanks a lot !
I have just installed this new build on Windows 8.1 - 64 bit.I have tested many G'MIC filters and they all work fine :-)
 


     Il Sabato 11 Luglio 2015 10:44, Boudewijn Rempt <boud@valdyas.org> ha scritto:
   
 

 https://bugs.kde.org/show_bug.cgi?id=345707

--- Comment #13 from Boudewijn Rempt <boud@valdyas.org> ---
Hi, following Lukas' commit, I've made a new windows build for testing: 

http://files.kde.org/krita/windows/krita_x64_2.9.6.2_gmictest.zip
Comment 15 LukasT 2015-07-18 07:50:51 UTC
Silvio, can we close this bug as resolved if it works with the test build?
Comment 16 Silvio Grosso 2015-07-18 09:32:34 UTC
Hi Lukas,

You can close this bug since G'MIC works fine (with this windows build) both on Windows 7 - 64 bit and Windows 8.1 - 64 bit.
Thanks a lot indeed :-)