Bug 426432

Summary: kmail 5.15.1: Crash when sending encrypted mail
Product: [Applications] kontact Reporter: Axel Braun <axel.braun>
Component: mailAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: bugs, hpj, montel, sknauss
Priority: NOR    
Version: 5.15.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.16.1
Attachments: Deugging output (backtrace)
backtrace

Description Axel Braun 2020-09-12 06:59:09 UTC
SUMMARY
When sending an encrypted mail, the box to select/confirm the recipients key comes up, then KMail crashes.
On restart, mail is in draft mode, not necessarily complete 

Operating System: openSUSE Tumbleweed 20200909
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.73.0
Qt Version: 5.15.0
Comment 1 Laurent Montel 2020-09-12 08:34:43 UTC
bactrace ?
Comment 2 Axel Braun 2020-09-12 09:11:06 UTC
(In reply to Laurent Montel from comment #1)
> bactrace ?

konqi did not deliver one - how can I force this?
From journalctl:

Sep 12 11:08:48 X1E kontact[2623]: org.kde.pim.kmail: Danger, using an event loop, this should no longer be happening!
Sep 12 11:08:48 X1E kontact[2623]: org.kde.pim.kmail: Danger, using an event loop, this should no longer be happening!
Sep 12 11:08:48 X1E kontact[2623]: org.kde.pim.kmail: Danger, using an event loop, this should no longer be happening!
Sep 12 11:08:48 X1E kontact[2623]: org.kde.pim.kmail: Danger, using an event loop, this should no longer be happening!
Sep 12 11:08:48 X1E kontact[2623]: org.kde.pim.kmail: Danger, using an event loop, this should no longer be happening!
Sep 12 11:08:48 X1E kontact[2623]: org.kde.pim.kmail: Danger, using an event loop, this should no longer be happening!
Sep 12 11:08:50 X1E akonadiserver[2187]: org.kde.pim.akonadiserver: Subscriber "TagActionManagerMonitor - 94669754611696" disconnected
Sep 12 11:08:50 X1E akonadiserver[2187]: org.kde.pim.akonadiserver: Subscriber "MessageListTagCacheMonitor - 94669922874192" disconnected
Sep 12 11:08:50 X1E akonadiserver[2187]: org.kde.pim.akonadiserver: Subscriber "KMail Kernel ETM - 94669749571008" disconnected
Sep 12 11:08:50 X1E akonadiserver[2187]: org.kde.pim.akonadiserver: Subscriber "MessageListTagMonitor - 94669752516464" disconnected
Sep 12 11:08:50 X1E akonadiserver[2187]: org.kde.pim.akonadiserver: Subscriber "FilterManagerTagMonitor - 94669755433472" disconnected
Sep 12 11:08:50 X1E kded5[2059]: Service  ":1.124" unregistered
Sep 12 11:08:50 X1E akonadiserver[2187]: org.kde.pim.akonadiserver: Subscriber "SpecialCollectionsMonitor - 94669751673840" disconnected
Sep 12 11:08:50 X1E akonadiserver[2187]: org.kde.pim.akonadiserver: Subscriber "MessageViewerMonitor - 94669752116256" disconnected
Sep 12 11:08:50 X1E kded5[2059]: Service  ":1.123" unregistered
Sep 12 11:08:50 X1E systemd[1924]: apps-kontact-ec847e3cf3c34bf8bc4f370f21de09c4.scope: Succeeded.
Sep 12 11:08:50 X1E kwin_x11[2063]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 15699, resource id: 188743703, major code: 15 (QueryTree), minor code: 0
Sep 12 11:08:50 X1E kwin_x11[2063]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 15741, resource id: 188745525, major code: 15 (QueryTree), minor code: 0
Sep 12 11:08:50 X1E kwin_x11[2063]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 15746, resource id: 188745525, major code: 18 (ChangeProperty), minor code: 0
Sep 12 11:08:50 X1E plasmashell[2114]: file:///usr/share/plasma/plasmoids/org.kde.plasma.taskmanager/contents/ui/Task.qml:285:5: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
Comment 3 Axel Braun 2020-09-12 18:57:45 UTC
After installing some 10.000 debugsource-packages:
docb@X1E:~> gdb kontact
GNU gdb (GDB; openSUSE Tumbleweed) 9.2
Copyright (C) 2020 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-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
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 kontact...
Reading symbols from /usr/lib/debug/usr/bin/kontact-20.08.1-1.1.x86_64.debug...
(gdb) run
Starting program: /usr/bin/kontact 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffe426d700 (LWP 10804)]
[New Thread 0x7fffe34a0700 (LWP 10813)]
[New Thread 0x7fffdae6d700 (LWP 10815)]
[Detaching after fork from child process 10816]
[Detaching after fork from child process 10817]
[New Thread 0x7fffda66c700 (LWP 10820)]
[New Thread 0x7fffd9e6b700 (LWP 10821)]
[New Thread 0x7fffd966a700 (LWP 10822)]
[New Thread 0x7fffd8e69700 (LWP 10823)]
[New Thread 0x7fffbffff700 (LWP 10824)]
[New Thread 0x7fffbf7fe700 (LWP 10825)]
[New Thread 0x7fffbe7fc700 (LWP 10827)]
[New Thread 0x7fffbeffd700 (LWP 10826)]
[New Thread 0x7fffbdffb700 (LWP 10828)]
[New Thread 0x7fffbd7fa700 (LWP 10829)]
[New Thread 0x7fffbcff9700 (LWP 10830)]
[New Thread 0x7fffb7fff700 (LWP 10831)]
[New Thread 0x7fffb73fe700 (LWP 10832)]
[Detaching after fork from child process 10833]
[New Thread 0x7fffb6bfd700 (LWP 10834)]
[New Thread 0x7fffb63fc700 (LWP 10835)]
[New Thread 0x7fff8fbef700 (LWP 10874)]
[New Thread 0x7fff8f362700 (LWP 10875)]
[New Thread 0x7fff8eb61700 (LWP 10877)]
[New Thread 0x7fff8dce8700 (LWP 10887)]
[New Thread 0x7fff8d4e7700 (LWP 10888)]
[New Thread 0x7fff8cce6700 (LWP 10889)]
[New Thread 0x7fff73fff700 (LWP 10890)]
No text-to-speech plug-ins were found.
[Detaching after fork from child process 10891]
[Detaching after fork from child process 10893]
[Detaching after fork from child process 10895]
[Detaching after fork from child process 10897]
[Detaching after fork from child process 10899]
org.kde.pim.kmail: setFcc: collection invalid  ""
[Detaching after fork from child process 10909]
[New Thread 0x7fff72a33700 (LWP 10914)]
Cannot initialize model with data QJsonObject() . missing: QJsonValue(string, "urls")
"http://news.opensuse.org/?feed=rss2"
"http://planet.opensuse.org/en/rss20.xml"
"http://www.novell.com/linux/security/suse_security.xml"
"http://www.kde.org/dotkdeorg.rdf"
"http://planetkde.org/rss20.xml"
"http://www.kde.org/dot/kde-apps-content.rdf"
"file:///home/docb/.mozilla/firefox/rcetwhmx.default/mimeTypes.rdf"
[New Thread 0x7fff62fff700 (LWP 10946)]
[New Thread 0x7fff61efd700 (LWP 10948)]
[New Thread 0x7fff626fe700 (LWP 10947)]
org.kde.pim.akregator: Invalid url "/home/docb/.cache/favicons/planetkde.org.png"
kf.kio.core: Invalid URL: QUrl("/home/docb/.cache/favicons/planetkde.org.png")
org.kde.pim.akregator: Invalid url "/home/docb/.cache/favicons/www.novell.com.png"
kf.kio.core: Invalid URL: QUrl("/home/docb/.cache/favicons/www.novell.com.png")
[New Thread 0x7fff616fc700 (LWP 10975)]
org.kde.pim.akregator: Invalid url "/home/docb/.cache/favicons/planet.opensuse.org.png"
kf.kio.core: Invalid URL: QUrl("/home/docb/.cache/favicons/planet.opensuse.org.png")
[New Thread 0x7fff53cff700 (LWP 10992)]
org.kde.pim.akonadicore: Received response with a different tag!
[Detaching after fork from child process 11021]
[Detaching after fork from child process 11023]
[Detaching after fork from child process 11025]
[Detaching after fork from child process 11028]
[Detaching after fork from child process 11031]
[Detaching after fork from child process 11033]
[Detaching after fork from child process 11035]
[Detaching after fork from child process 11037]
[New Thread 0x7fff534fe700 (LWP 11040)]
[Detaching after fork from child process 11041]
[Thread 0x7fff534fe700 (LWP 11040) exited]
Thread 1 "kontact" received signal SIGSEGV, Segmentation fault.
0x0000555564086590 in ?? ()
(gdb)
Comment 4 Christoph Feck 2020-09-13 03:14:26 UTC
You need to use the 'bt' command in gdb after the crash to get the actual backtrace. For more information, please see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
Comment 5 Axel Braun 2020-09-13 07:39:34 UTC
(In reply to Christoph Feck from comment #4)
> You need to use the 'bt' command in gdb after the crash to get the actual
> backtrace. For more information, please see
> https://community.kde.org/Guidelines_and_HOWTOs/Debugging/
> How_to_create_useful_crash_reports

Thanks for the hint, Christoph. I was actually following https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports#Retrieving_a_backtrace_when_an_uncaught_exception_is_causing_a_crash which leads to a kontact window not being properly redrawn, means showing the background of whatever was just on the screen.
So I cant use kontact to reproduce the crash.
Tried already to switch video driver from nvidia to intel, no change in results.
Any idea?
Comment 6 Hans-Peter Jansen 2020-09-16 09:06:08 UTC
If I understand you correctly, this is usual behavior for a gdb session. At the moment, gdb chimes in, all debugged processes are halted.

Just type bt or bt -full and post the result.

Also, you may want to just run gdb kmail.
Comment 7 Axel Braun 2020-09-16 10:37:16 UTC
Created attachment 131692 [details]
Deugging output (backtrace)
Comment 8 Axel Braun 2020-10-26 13:05:23 UTC
Created attachment 132757 [details]
backtrace

Issue persists with
Operating System: openSUSE Tumbleweed 20201023
KDE Plasma Version: 5.20.1
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.1

first line of backtrace says:
Thread 1 "kmail" received signal SIGSEGV, Segmentation fault.
0x00007fffedf11667 in KMime::Headers::Base::is (this=this@entry=0x55556428ade0, t=t@entry=0x7fffedf29fd4 "Content-Type") at /usr/src/debug/kmime-20.08.2-1.1.x86_64/src/kmime_headers.cpp:153

issue with mime-types?
Comment 9 Martin van Es 2020-11-12 10:49:00 UTC
For what it's worth, I'm seeing exactly the same issue. Encrypting mails pops up the key chooser, but when I finally choose OK on Encryption Key Approval dialog the mail becomes lighter coloured as if it were completely locked and then after a couple of seconds kmail crashes. I also see the same event loop warning and no Konqi appearing.

This is the best bt I can deliver at the moment (given I have not checked what debug packages I need)

Thread 1 "kmail" received signal SIGSEGV, Segmentation fault.
0x00007fffee02d7db in KMime::Headers::Base::is(char const*) const () from /usr/lib/x86_64-linux-gnu/libKF5Mime.so.5abi2
(gdb) bt
#0  0x00007fffee02d7db in KMime::Headers::Base::is(char const*) const () from /usr/lib/x86_64-linux-gnu/libKF5Mime.so.5abi2
#1  0x00007fffee025aef in KMime::Content::headerByType(char const*) const () from /usr/lib/x86_64-linux-gnu/libKF5Mime.so.5abi2
#2  0x00007fffee0273bd in KMime::Content::contentType(bool) () from /usr/lib/x86_64-linux-gnu/libKF5Mime.so.5abi2
#3  0x00007fffeec887a8 in ?? () from /usr/lib/x86_64-linux-gnu/libKF5MessageComposer.so.5abi2
#4  0x00007fffeec1d998 in ?? () from /usr/lib/x86_64-linux-gnu/libKF5MessageComposer.so.5abi2
#5  0x00007fffefaba2e6 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007fffee518b35 in QGpgME::EncryptJob::result(GpgME::EncryptionResult const&, QByteArray const&, QString const&, GpgME::Error const&) () from /usr/lib/x86_64-linux-gnu/libqgpgme.so.7
#7  0x00007fffee5372ab in QGpgME::_detail::ThreadedJobMixin<QGpgME::EncryptJob, std::tuple<GpgME::EncryptionResult, QByteArray, QString, GpgME::Error> >::slotFinished() () from /usr/lib/x86_64-linux-gnu/libqgpgme.so.7
#8  0x00007fffefab0651 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007ffff053a013 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007fffefa841ca in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#11 0x00007fffefa86bc1 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007fffefadc1c7 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007fffe8dcf4db in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00007fffe8dcf788 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007fffe8dcf853 in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007fffefadb843 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007fffefa82a4b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007fffefa8afc6 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x0000555555558902 in ?? ()
#20 0x00007fffef436cb2 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#21 0x0000555555558a8e in ?? ()
Comment 10 Axel Braun 2020-11-25 07:38:38 UTC
Changing to confirmed.

Sorry, but a *mayor feature* - encryption - is broken in KMail.

KMail is unuseable at the moment if you have to care about privacy.

Can you please fix this?

Thank you!
Comment 11 Laurent Montel 2020-11-25 07:57:03 UTC
it works fine here.
I use smime encryption.
Could you test on 5.16.0 ?
Regards
Comment 12 Axel Braun 2020-11-25 08:16:21 UTC
(In reply to Laurent Montel from comment #11)
> it works fine here.
> I use smime encryption.

I use GNUpg....that makes probably the difference

> Could you test on 5.16.0 ?

Need to check if this is available for Tumbleweed
Comment 13 Laurent Montel 2020-11-25 12:30:13 UTC
(In reply to Axel Braun from comment #12)
> (In reply to Laurent Montel from comment #11)
> > it works fine here.
> > I use smime encryption.
> 
> I use GNUpg....that makes probably the difference
> 
> > Could you test on 5.16.0 ?
> 
> Need to check if this is available for Tumbleweed

I created a openpgp key and it crashs indeed when we encrypt.
Sign with same key works.
Comment 14 Axel Braun 2020-12-02 13:22:12 UTC
(In reply to Laurent Montel from comment #13)

> I created a openpgp key and it crashs indeed when we encrypt.
> Sign with same key works.

Sign alone is not enough :-)
As you could reproduce it there is probably no need anymore to test the devel version, correct?
Comment 15 Sandro Knauß 2020-12-16 22:51:04 UTC
There was an outstanding merge request since November, as I found the issue from our CI infrastructure but never heard about this bug yet, because I normally use Encrypt+Sign: 
https://invent.kde.org/pim/messagelib/-/merge_requests/14

Workaround is use Encrypt+Sign, as this is using a different code path, that was not hit by this one.