Bug 384026 - G'MIC unresponsive when using unsupported output mode, and crashes Krita if force-closed
Summary: G'MIC unresponsive when using unsupported output mode, and crashes Krita if f...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: G'Mic for Krita (show other bugs)
Version: unspecified
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-25 20:51 UTC by Silvio Grosso
Modified: 2017-08-26 17:32 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
krita crash log (8.12 KB, text/plain)
2017-08-25 20:51 UTC, Silvio Grosso
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Silvio Grosso 2017-08-25 20:51:11 UTC
Created attachment 107522 [details]
krita crash log

I have downloaded today's new version : Krita 3.2.1 (X64.exe installer)
I have installed it on Windows 7 (64 bit) but it is so buggy on this platform I have gave up using it (most of G'mic filters do not work on it properly)... :-(
This was true for all last versions of Krita 3.2.X (on W7) too therefore it is not a regression :-)

Needless to say , I have continued testing Krita 3.2.1 on a different computer: Windows 10 (64 bit) with the .exe installer as usual.
On this new system G'mic works *much* better (but still extremely buggy compared to Gimp 2.8.22 and G'mic 2.0.3 - Qt version).

In short, on Windows 10 (64 bit) I can always reproduce a crash : no matter what jpeg image i try. I even reproduce easily this crash on Windows 7.

My system has:
Windows 10 (64 bit)
CPU Intel I7
8 Gb Ram
Nvidia graphic card
OpenGl is OFF (in the Krita Preferences).

To always reproduce to crash you should:
- open a jpeg image (no matter what image crashed Krita later on);
- Launch G'mic 2.0.3 ;
- Choose the "Faded filter" - Arrays group ;
- Choose to create a new layer (even though this option is not supported yet...) ;
- Click OK to apply this filter : Krita crashes as soon as you you try to close the G'mic windows

I have recorded a mp4 video with all my steps to always reproduce this crash:
https://www.dropbox.com/s/36h8addlc69cl5y/GMIC_2.0.3_CRASH_ARRAY_FADED_FILTER.mp4?dl=0
It plays fine with Vlc media player (for instance through Firefox 55.0.2)

I have tried to catch a backtrace too by downloading the debug symbols as suggested. Here it is (hope it is useful):
https://www.dropbox.com/s/537cexetmc23a8b/kritacrash_ARRAY_FADED_FILTER.log?dl=0
Comment 1 Halla Rempt 2017-08-25 21:02:54 UTC
Hi Silvio,

Are you trying to use a gmic-qt from the gmic website, or the one that comes with Krita?
Comment 2 Silvio Grosso 2017-08-25 21:09:07 UTC
Hi Boud ! :-)

I have always tested the G'mic version shipped with Krita 2.3.x so far.

I have read you "should" do so because the Qt versions (krita and G'mic QT plugin) should be the same...

With Gimp 2.8.22, on Windows, I download the Zip version (64 bit) from the G'MIC web site and I install (unzip) it manually.
Comment 3 Alvin Wong 2017-08-26 08:08:36 UTC
(In reply to Silvio Grosso from comment #2)
> Hi Boud ! :-)
> 
> I have always tested the G'mic version shipped with Krita 2.3.x so far.
> 
> I have read you "should" do so because the Qt versions (krita and G'mic QT
> plugin) should be the same...
> 
> With Gimp 2.8.22, on Windows, I download the Zip version (64 bit) from the
> G'MIC web site and I install (unzip) it manually.

Hi, from your video it appears you are using the gmic-qt from the G'mic website (released on 2017-08-11) insntead of the bundled version (it can be seen on the title).

Can you try manually pointing the gmic-qt plugin to "C:/Program Files/Krita (x64)/bin/gmic_krita_qt.exe" in the Configure Krita dialog?
Comment 4 Silvio Grosso 2017-08-26 14:28:38 UTC
Hello Alvin !

First off, thanks a lot indeed for your help.
You were right !
Yesterday, my g'mic path was:
C:/gmic-krita-qt-2.0.3_pre-win64/gmic_krita_qt.exe
G'mic Version was: 2.0.3 170811 

After your message new path is set by me manually as:
C:/Program Files/Krita (x64)/bin/gmic_krita_qt.exe

I don't know why Krita 2.3.1 picked up the wrong path because I have installed it through the x64.exe installer *without* getting a different version from the G'MIC websit.
My wild guess is that maybe Krita picked up the wrong setting through some old configuration file still present on my computer (e.g. kritarc etc).

To make it short though the crash is still there even with the new setting :-(
Here it is the new log crash file on Windows 10 - 64 bit:
https://www.dropbox.com/s/0snontzroktebp5/kritacrash_2.0.4_new_gmic_settings.txt?dl=0

To force this crash it looks like you must close the  main G'mic window with all filters settings and only *afterwards* the secondary window which informs you that "the option to add a new layer is not implemented yet on Krita". If you close this secondary window at first most of the time only G'MIC crashes but Krita 2.3.1 continues working.

At present with the new path (and G'MIC 2.0.4) all filters which create a new window are no longer working (curves, extract foreground, colorize interactive).
Here is the message error:
*** Error in ./fx_extract_foreground/*repeat/*local/*substitute/ *** Command '-x_segment': No display available.
It is weird because this is the bug which Boud was aware of and I have read it was supposed to being fixed in this new version (2.3.1).
These filters were a *BIG* problems on Windows in the past with the old version of Krita. This error was often present when a new krita version was released.

Strangely enough, with yesterday's  "wrong" path these filters were "OK" on Windows 10 in that at least they didn't display any error when you tried to work with them. But again, their result was totally wrong in the end when you clicked ok...

Btw, with Windows 7 (64 bit) I have changed the path manually as well. 
Now I run G'MIC 2.0.4 (taken from the bin folder). 
Unfortunately, the crash still occurs on this platform too. 
For instance, I have tried the black-white filter (with the option to "add a new layer") and as soon as I have clicked Ok Krita 2.3.1 suddenly crashed.
Even on this platform the interactive filters (curve, extract foreground etc) display the usual message error (No display available).
Comment 5 Alvin Wong 2017-08-26 15:34:27 UTC
(In reply to Silvio Grosso from comment #4)
> Hello Alvin !
> 
> First off, thanks a lot indeed for your help.
> You were right !
> Yesterday, my g'mic path was:
> C:/gmic-krita-qt-2.0.3_pre-win64/gmic_krita_qt.exe
> G'mic Version was: 2.0.3 170811 
> 
> After your message new path is set by me manually as:
> C:/Program Files/Krita (x64)/bin/gmic_krita_qt.exe
> 
> I don't know why Krita 2.3.1 picked up the wrong path because I have
> installed it through the x64.exe installer *without* getting a different
> version from the G'MIC websit.
> My wild guess is that maybe Krita picked up the wrong setting through some
> old configuration file still present on my computer (e.g. kritarc etc).

That's actually a weakness of the way Krita is handling the gmic-qt configuration... if you have ever set a custom path before in the earlier beta versions it will not be overridden, because use the same configuration entry.


> To make it short though the crash is still there even with the new setting
> :-(
> Here it is the new log crash file on Windows 10 - 64 bit:
> https://www.dropbox.com/s/0snontzroktebp5/kritacrash_2.0.4_new_gmic_settings.
> txt?dl=0
> 
> To force this crash it looks like you must close the  main G'mic window with
> all filters settings and only *afterwards* the secondary window which
> informs you that "the option to add a new layer is not implemented yet on
> Krita". If you close this secondary window at first most of the time only
> G'MIC crashes but Krita 2.3.1 continues working.

Thanks for the info, now I can get a crash in Krita but I'm getting a different backtrace than yours...



(technical details below)

I'm actually getting a slightly different backtrace for the few times I've tried, but they all fail at plugins\extensions\qmic\QMic.cpp:293 (frame #4 in the below backtrace), which I suppose would be due to Krita trying to write a message reply to the closed QLocalSocket (due to gmic-qt being closed early).

There are several issues that contributes to this:

1. The gmic-qt plugin does the QLocalSocket IPC on the UI thread (so does Krita, but it's not really relevant here)
2. Krita shows a message box during the IPC (lien 270) and did not send a response before that, which in turn blocked gmic-qt due to #1
3.Since gmic-qt is blocked, Windows will kindly offer to force-close it, and thus the QLocalSocket will be killed
4. Krita tries to send the reply after the message box is dismissed, but the socket is closed so it causes a crash (doesn't really make sense that the write call doesn't check if the socket is closed...)


A possible quick fix is to defer the message box to show *after* the IPC is completed (i.e. replyis sent back to gmic-qt and socket is closed normally)


#0  0x0000000068975100 in QIODevicePrivate::~QIODevicePrivate() () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#1  0x000000006897731c in QIODevice::write(char const*, long long) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#2  0x000000006896270a in QDataStream::operator<<(int) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#3  0x0000000068962a21 in QDataStream::writeBytes(char const*, unsigned int) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#4  0x000007fe815981f2 in QMic::connected (this=0x168cd5c0) at F:\dev\krita\src_3.2\plugins\extensions\qmic\QMic.cpp:293
#5  0x000007fe815abcf5 in QMic::qt_static_metacall (_o=0x168cd5c0, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>)
    at F:/dev/krita/b_mgw54_x64_3.2/build_krita/plugins/extensions/qmic/moc_QMic.cpp:118
#6  0x0000000068a2e3fa in QMetaObject::activate(QObject*, int, int, void**) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#7  0x0000000005156fa3 in QLocalSocket::connectToServer(QFlags<QIODevice::OpenModeFlag>) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Network.dll
#8  0x0000000068a2e3fa in QMetaObject::activate(QObject*, int, int, void**) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#9  0x0000000068a96f50 in QWinEventNotifier::activated(void*, QWinEventNotifier::QPrivateSignal) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#10 0x0000000068a5072f in QWinEventNotifier::event(QEvent*) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#11 0x0000000000e2a33c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Widgets.dll
#12 0x0000000000e2f6a0 in QApplication::notify(QObject*, QEvent*) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Widgets.dll
#13 0x000007feb7d67f86 in KisApplication::notify (this=<optimized out>, receiver=0x310daf50, event=0x22c110)
    at F:\dev\krita\src_3.2\libs\ui\KisApplication.cpp:543
#14 0x0000000068a0e312 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#15 0x0000000068a5404b in QEventDispatcherWin32Private::activateEventNotifier(QWinEventNotifier*) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#16 0x0000000068a549b1 in QEventDispatcherWin32::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#17 0x000000000715ab55 in qwindows!qt_plugin_instance () from F:\dev\krita\b_mgw54_x64_3.2\install\plugins\platforms\qwindows.dll
#18 0x0000000068a0d5ea in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#19 0x0000000068a14207 in QCoreApplication::exec() () from F:\dev\krita\b_mgw54_x64_3.2\install\bin\Qt5Core.dll
#20 0x0000000140005b87 in main (argc=1, argv=0x6fd05c0) at F:\dev\krita\src_3.2\krita\main.cc:289
Comment 6 Alvin Wong 2017-08-26 17:29:21 UTC
Git commit 59f2c4b36f4bcf25a80ab70f3ca4f58d1478a34a by Alvin Wong.
Committed on 26/08/2017 at 17:26.
Pushed by alvinwong into branch 'krita/3.2'.

Prevent blocking the gmic-qt IPC with message box

M  +9    -1    plugins/extensions/qmic/QMic.cpp

https://commits.kde.org/krita/59f2c4b36f4bcf25a80ab70f3ca4f58d1478a34a
Comment 7 Alvin Wong 2017-08-26 17:32:42 UTC
Git commit 6c831def05222cc12b31ce7c9218892cce1c0f44 by Alvin Wong.
Committed on 26/08/2017 at 17:32.
Pushed by alvinwong into branch 'master'.

Prevent blocking the gmic-qt IPC with message box

M  +9    -1    plugins/extensions/qmic/QMic.cpp

https://commits.kde.org/krita/6c831def05222cc12b31ce7c9218892cce1c0f44