Bug 449826

Summary: Kmail crashes the moment an encrypted email is selected
Product: [Applications] kmail2 Reporter: thomas
Component: message listAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED DOWNSTREAM    
Severity: crash CC: arojas, besc, demm, kde, kdebugs, pejakm, sam, whatifgodwasoneofus
Priority: NOR    
Version: 5.19.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description thomas 2022-02-09 08:33:29 UTC
SUMMARY
***
I am using S/MIME encrypted emails quite heavily, however after a OS reboot yesterday, Kmail would crash immediately at launch.
After some investigation it turned out that the mail Kmail tried to display during start was encrypted. After removing that email via AkonadiConsole Kmail starts again, but the moment I click on another encrypted email it will crash again.
***


STEPS TO REPRODUCE
1. Launch Kmail
2. Select S/MIME encrypted email in message list
3. Crash

OBSERVED RESULT
Crash

EXPECTED RESULT
Show the email content

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Kernel Version: 5.16.7-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6920HQ CPU @ 2.90GHz
Memory: 31,1 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 530

ADDITIONAL INFORMATION
Starting kmail from within a terminal shows the below, the flite message is a red herring in my opinion, it's not installed and shows right after the start, not at the time of the crash. I did install flite to see what happens to the error, no effect other than that flite message disappearing, so removed again.  Things will be quiet until I select an encrypted message which immediately leads to the signal 11 message and a lengthy systemd-coredump in journalctl.

´´´
kmail
Error loading text-to-speech plug-in "flite"
Cannot initialize model with data QJsonObject(). missing: QJsonValue(string, "urls")
 list count   1
 list count   1
*** KMail got signal 11 (Exiting)
*** Dead letters dumped.
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kmail path = /usr/bin pid = 8909
KCrash: Arguments: /usr/bin/kmail 
QSocketNotifier: Invalid socket 10 and type 'Read', disabling...
QSocketNotifier: Invalid socket 20 and type 'Read', disabling...
QSocketNotifier: Invalid socket 59 and type 'Read', disabling...
QSocketNotifier: Invalid socket 98 and type 'Read', disabling...
failed to signal syncobj 35
Unable to start Dr. Konqi
Re-raising signal for core dump handling.
[1]    8909 abort (core dumped)  kmail
´´´
Comment 1 thomas 2022-02-09 13:59:21 UTC
Went through the Plasma 5.24 update this morning, unfortunately no luck.
Comment 2 lod 2022-02-09 14:35:35 UTC
I'm running in a similar problem. When I try to reply on certain mail accounts (just one of the two are encrypted)  kmail/kontact crashes and I have to remove the kmail2 folder from ~/.local/share to be able to start it again.

Application: KMail (kmail), signal: Segmentation fault

[KCrash Handler]
#4  0x00007ff4c69f69f3 in  () at /usr/lib/libqgpgme.so.7
#5  0x00007ff4c69f6b86 in QGpgME::QGpgMEAddUserIDJob::start(GpgME::Key const&, QString const&, QString const&, QString const&) () at /usr/lib/libqgpgme.so.7
#6  0x00007ff4d10b6059 in  () at /usr/lib/libkmailprivate.so.5
#7  0x00007ff4c81ecd93 in  () at /usr/lib/libQt5Core.so.5
#8  0x00007ff4c7373364 in MessageComposer::RecipientLineNG::analyzeLine(QString const&) () at /usr/lib/libKF5MessageComposer.so.5
#9  0x00007ff4c81ecd93 in  () at /usr/lib/libQt5Core.so.5
#10 0x00007ff4c8d65ef7 in QLineEdit::textChanged(QString const&) () at /usr/lib/libQt5Widgets.so.5
#11 0x00007ff4c81ecddf in  () at /usr/lib/libQt5Core.so.5
#12 0x00007ff4c8d711fa in QWidgetLineControl::textChanged(QString const&) () at /usr/lib/libQt5Widgets.so.5
#13 0x00007ff4c8d74eb1 in QWidgetLineControl::finishChange(int, bool, bool) () at /usr/lib/libQt5Widgets.so.5
#14 0x00007ff4c8d75199 in QWidgetLineControl::internalSetText(QString const&, int, bool) () at /usr/lib/libQt5Widgets.so.5
#15 0x00007ff4c6dcac39 in PimCommon::AddresseeLineEdit::setText(QString const&) () at /usr/lib/libKF5PimCommonAkonadi.so.5
#16 0x00007ff4c73708af in MessageComposer::RecipientLineNG::fieldsFromData() () at /usr/lib/libKF5MessageComposer.so.5
#17 0x00007ff4c73709de in MessageComposer::RecipientLineNG::setData(QSharedPointer<KPIM::MultiplyingLineData> const&) () at /usr/lib/libKF5MessageComposer.so.5
#18 0x00007ff4c65f6235 in KPIM::MultiplyingLineEditor::addData(QSharedPointer<KPIM::MultiplyingLineData> const&, bool) () at /usr/lib/libKF5Libkdepim.so.5
#19 0x00007ff4c7371133 in MessageComposer::RecipientsEditor::addRecipient(QString const&, MessageComposer::Recipient::Type) () at /usr/lib/libKF5MessageComposer.so.5
#20 0x00007ff4c7375cd5 in MessageComposer::RecipientsEditor::setRecipientString(QVector<KMime::Types::Mailbox> const&, MessageComposer::Recipient::Type) () at /usr/lib/libKF5MessageComposer.so.5
#21 0x00007ff4c734dd5a in MessageComposer::ComposerViewBase::setMessage(QSharedPointer<KMime::Message> const&, bool) () at /usr/lib/libKF5MessageComposer.so.5
#22 0x00007ff4d10a7180 in  () at /usr/lib/libkmailprivate.so.5
#23 0x00007ff4d10971a5 in  () at /usr/lib/libkmailprivate.so.5
#24 0x00007ff4d108bd96 in KMail::makeComposer(QSharedPointer<KMime::Message> const&, bool, bool, KMail::Composer::TemplateContext, unsigned int, QString const&, QString const&) () at /usr/lib/libkmailprivate.so.5
#25 0x00007ff4d10c7d18 in  () at /usr/lib/libkmailprivate.so.5
#26 0x00007ff4c81ecd93 in  () at /usr/lib/libQt5Core.so.5
#27 0x00007ff4c7323dd7 in MessageComposer::MessageFactoryNG::createReplyDone(MessageComposer::MessageFactoryNG::MessageReply const&) () at /usr/lib/libKF5MessageComposer.so.5
#28 0x00007ff4c739be95 in MessageComposer::MessageFactoryNG::slotCreateReplyDone(QSharedPointer<KMime::Message> const&, bool) () at /usr/lib/libKF5MessageComposer.so.5
#29 0x00007ff4c81ecd93 in  () at /usr/lib/libQt5Core.so.5
#30 0x00007ff4c739dac4 in  () at /usr/lib/libKF5MessageComposer.so.5
#31 0x00007ff4c81ecd93 in  () at /usr/lib/libQt5Core.so.5
#32 0x00007ff4c7275a24 in TemplateParser::TemplateParserJob::parsingDone(bool) () at /usr/lib/libKF5TemplateParser.so.5
#33 0x00007ff4c7279e2d in TemplateParser::TemplateParserJob::slotExtractInfoDone(TemplateParserExtractHtmlInfoResult const&) () at /usr/lib/libKF5TemplateParser.so.5
#34 0x00007ff4c81ecd93 in  () at /usr/lib/libQt5Core.so.5
#35 0x00007ff4c728c1f1 in  () at /usr/lib/libKF5TemplateParser.so.5
#36 0x00007ff4c81ecd93 in  () at /usr/lib/libQt5Core.so.5
#37 0x00007ff4c728ccfe in  () at /usr/lib/libKF5TemplateParser.so.5
#38 0x00007ff4bfab12e6 in  () at /usr/lib/libQt5WebEngineWidgets.so.5
#39 0x00007ff4c9d5a459 in  () at /usr/lib/libQt5WebEngineCore.so.5
#40 0x00007ff4c9d642b3 in  () at /usr/lib/libQt5WebEngineCore.so.5
#41 0x00007ff4ca7cbdd5 in  () at /usr/lib/libQt5WebEngineCore.so.5
#42 0x00007ffded167f20 in  ()
#43 0x000056274f3f8970 in  ()
#44 0x0000000000000009 in  ()
#45 0x000056274d4d4da0 in  ()
#46 0x0000000000000000 in  ()
[Inferior 1 (process 830562) detached]
Comment 3 whatifgodwasoneofus 2022-02-12 12:41:53 UTC
I also have the same issue reported by thomas@zell-mbc.com.

I am on:

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Kernel Version: 5.16.7-1-MANJARO (x86_64)
Graphics Platform: X11
Processors: 8 × Intel(R) Core(TM) i7 CPU   @ 3.07GHz
Memory: 24 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1650
Comment 4 demm 2022-02-12 16:16:57 UTC
This is an issue with gpgme 1.17.0 only, downgrade to 1.16.0, and kmail runs just fine with encrypted mails.  But is this an issue for gpgme, or needs kmail adjusting for new gpgme?
Comment 5 Antonio Rojas 2022-02-12 17:17:13 UTC
Complete backtrace

#0  0x00007fffe5f324cb in gpgme_op_delete (ctx=0x555556cdb4e0, key=0x555556bdd520, allow_secret=224) at /build/gpgme/src/gpgme-1.17.0/src/delete.c:154
#1  0x00007fffed64be2b in GpgME::Context::deleteKey(GpgME::Key const&, bool)
    (this=this@entry=0x555556b25370, key=<optimized out>, allowSecretKeyDeletion=<optimized out>)
    at /build/gpgme/src/gpgme-1.17.0/lang/cpp/src/context.cpp:831
#2  0x00007fffed706de0 in delete_key(GpgME::Context*, GpgME::Key const&, bool)
    (ctx=0x555556b25370, key=<optimized out>, allowSecretKeyDeletion=<optimized out>) at /build/gpgme/src/gpgme-1.17.0/lang/qt/src/qgpgmedeletejob.cpp:59
#3  0x00007fffed701100 in std::__invoke_impl<std::tuple<GpgME::Error, QString, GpgME::Error>, std::tuple<GpgME::Error, QString, GpgME::Error> (*&)(GpgME::Context*, GpgME::Key const&, bool), GpgME::Context*&, GpgME::Key&, bool&>(std::__invoke_other, std::tuple<GpgME::Error, QString, GpgME::Error> (*&)(GpgME::Context*, GpgME::Key const&, bool), GpgME::Context*&, GpgME::Key&, bool&) (__f=<optimized out>) at /usr/include/c++/11.1.0/bits/invoke.h:61
#4  std::__invoke<std::tuple<GpgME::Error, QString, GpgME::Error> (*&)(GpgME::Context*, GpgME::Key const&, bool), GpgME::Context*&, GpgME::Key&, bool&>(std::tuple<GpgME::Error, QString, GpgME::Error> (*&)(GpgME::Context*, GpgME::Key const&, bool), GpgME::Context*&, GpgME::Key&, bool&)
    (__fn=<optimized out>) at /usr/include/c++/11.1.0/bits/invoke.h:97
#5  std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)>::__call<std::tuple<GpgME::Error, QString, GpgME::Error>, GpgME::Context*&, 0ul, 1ul, 2ul>(std::tuple<GpgME::Context*&>&&, std::_Index_tuple<0ul, 1ul, 2ul>)
    (__args=<optimized out>, this=<optimized out>) at /usr/include/c++/11.1.0/functional:422
#6  std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)>::operator()<GpgME::Context*&, std::tuple<GpgME::Error, QString, GpgME::Error> >(GpgME::Context*&) (this=<optimized out>)
    at /usr/include/c++/11.1.0/functional:505
#7  std::__invoke_impl<std::tuple<GpgME::Error, QString, GpgME::Error>, std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)>&, GpgME::Context*&>(std::__invoke_other, std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)>&, GpgME::Context*&) (__f=<optimized out>)
    at /usr/include/c++/11.1.0/bits/invoke.h:61
#8  std::__invoke<std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)>&, GpgME::Context*&>(std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)>&, GpgME::Context*&) (__fn=<optimized out>) at /usr/include/c++/11.1.0/bits/invoke.h:97
--Type <RET> for more, q to quit, c to continue without paging--
#9  std::_Bind<std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)> (GpgME::Context*)>::__call<std::tuple<GpgME::Error, QString, GpgME::Error>, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>)
    (__args=<optimized out>, this=<optimized out>) at /usr/include/c++/11.1.0/functional:422
#10 std::_Bind<std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)> (GpgME::Context*)>::operator()<, std::tuple<GpgME::Error, QString, GpgME::Error> >() (this=<optimized out>)
    at /usr/include/c++/11.1.0/functional:505
#11 std::__invoke_impl<std::tuple<GpgME::Error, QString, GpgME::Error>, std::_Bind<std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)> (GpgME::Context*)>&>(std::__invoke_other, std::_Bind<std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)> (GpgME::Context*)>&)
    (__f=<optimized out>) at /usr/include/c++/11.1.0/bits/invoke.h:61
#12 std::__invoke_r<std::tuple<GpgME::Error, QString, GpgME::Error>, std::_Bind<std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)> (GpgME::Context*)>&>(std::_Bind<std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)> (GpgME::Context*)>&) (__fn=<optimized out>)
    at /usr/include/c++/11.1.0/bits/invoke.h:116
#13 std::_Function_handler<std::tuple<GpgME::Error, QString, GpgME::Error> (), std::_Bind<std::_Bind<std::tuple<GpgME::Error, QString, GpgME::Error> (*(std::_Placeholder<1>, GpgME::Key, bool))(GpgME::Context*, GpgME::Key const&, bool)> (GpgME::Context*)> >::_M_invoke(std::_Any_data const&)
    (__functor=<optimized out>) at /usr/include/c++/11.1.0/bits/std_function.h:292
#14 0x00007fffed6f3917 in std::function<std::tuple<GpgME::Error, QString, GpgME::Error> ()>::operator()() const (this=0x555556ba5af0)
    at /usr/include/c++/11.1.0/bits/std_function.h:560
#15 QGpgME::_detail::Thread<std::tuple<GpgME::Error, QString, GpgME::Error> >::run() (this=0x555556ba5ad8)
    at /build/gpgme/src/gpgme-1.17.0/lang/qt/src/threadedjobmixin.h:115
#16 0x00007fffeed5f88c in QThreadPrivate::start(void*) (arg=0x555556ba5ad8) at thread/qthread_unix.cpp:331
#17 0x00007fffee8d65c2 in start_thread () at /usr/lib/libc.so.6
#18 0x00007fffee95b584 in clone () at /usr/lib/libc.so.6
Comment 6 Antonio Rojas 2022-02-12 18:11:15 UTC
Rebuilding messagelib fixes this. Looks like gpgme 1.17 had an unannounced ABI break.
Comment 7 thomas 2022-02-13 12:23:10 UTC
(In reply to Antonio Rojas from comment #6)
> Rebuilding messagelib fixes this. Looks like gpgme 1.17 had an unannounced
> ABI break.

Thank you very much for the quick turnaround! I can confirm things are working fine again with today's gpgme update.