Bug 342443

Summary: akonadi_mailfilter_agent crashes when filtering for address book entry
Product: [Frameworks and Libraries] Akonadi Reporter: Florian Kraus <flo>
Component: Mail Filter AgentAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: crash CC: montel
Priority: NOR    
Version: 1.13.0   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Florian Kraus 2015-01-03 14:34:16 UTC
I created a filter that should move all mails from members of my contacts to a IMAP directory.
When I run that filter manually the agent crashes with this message:


Application: Agent zur E-Mail-Filterung (akonadi_mailfilter_agent), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[KCrash Handler]
#5  0x00007fd75ddc8b08 in MailCommon::SearchRule::asString() const () from /usr/lib/libmailcommon.so.4
#6  0x00007fd75ddcbe74 in ?? () from /usr/lib/libmailcommon.so.4
#7  0x00007fd75ddcd59e in MailCommon::SearchPattern::matches(Akonadi::Item const&, bool) const () from /usr/lib/libmailcommon.so.4
#8  0x000000000040ea1a in _start ()


Reproducible: Always

Steps to Reproduce:
1. Add a filter with "From address book"
2. Apply filter on a IMAP directory


Actual Results:  
Application: Agent zur E-Mail-Filterung (akonadi_mailfilter_agent), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[KCrash Handler]
#5  0x00007fd75ddc8b08 in MailCommon::SearchRule::asString() const () from /usr/lib/libmailcommon.so.4
#6  0x00007fd75ddcbe74 in ?? () from /usr/lib/libmailcommon.so.4
#7  0x00007fd75ddcd59e in MailCommon::SearchPattern::matches(Akonadi::Item const&, bool) const () from /usr/lib/libmailcommon.so.4
#8  0x000000000040ea1a in _start ()


Expected Results:  
Filter correctly
Comment 1 Laurent Montel 2015-01-03 17:11:35 UTC
as you can reproduce all the time. could you install debug package and get a full debug backtrace please ?
Comment 2 Florian Kraus 2015-01-03 17:23:22 UTC
Hi Laurent,
since this is my first bugreport I'm not really sure what to do.
Which debug package(s) exactly?
How to get the full debug backtrace?
Comment 3 Laurent Montel 2015-01-03 17:37:13 UTC
"Application: Agent zur E-Mail-Filterung (akonadi_mailfilter_agent), signal: Segmentation fault Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [KCrash Handler] #5 0x00007fd75ddc8b08 in MailCommon::SearchRule::asString() const () from /usr/lib/libmailcommon.so.4 #6 0x00007fd75ddcbe74 in ?? () from /usr/lib/libmailcommon.so.4 #7 0x00007fd75ddcd59e in MailCommon::SearchPattern::matches(Akonadi::Item const&, bool) const () from /usr/lib/libmailcommon.so.4 #8 0x000000000040ea1a in _start ()"

it's a backtrace :)

Your distro provides debug package.
I don't know name of them on debian but perhaps there is a "-debug"

for example kdepim-debug.deb
Comment 4 Florian Kraus 2015-01-03 17:50:20 UTC
I think I got it.
I installed akonadi-dbg and after stopping akonadi and executing akonadictl start in a terminal window I got some debug output.

It looks like filterin works in the first place, since there are thousands of searches running before it crashes.
At the end I get this message

...
...
Executing search "akonadi_mailfilter_agent-SearchSession" 
Search done "akonadi_mailfilter_agent-SearchSession" (without remote search) 
        Result: 0 matches 
SEARCH: 
        Query: "{ "limit" : 1, "negated" : false, "rel" : 1, "subTerms" : [ { "cond" : 0, "key" : "email", "negated" : false, "value" : "#removed-for-bugreport#@web.de" } ] }" 
        MimeTypes: ("text/directory") 
        Collections: QVector(213, 213) 
        Remote: false 
        Recursive true 
Executing search "akonadi_mailfilter_agent-SearchSession" 
Search done "akonadi_mailfilter_agent-SearchSession" (without remote search) 
        Result: 0 matches 
void Akonadi::Server::NotificationSource::serviceUnregistered(const QString&) Notification source "akonadi_mailfilter_agent_13955_KMMBxd" now serving: () 
void Akonadi::Server::NotificationSource::serviceUnregistered(const QString&) Notification source "akonadi_mailfilter_agent_13955_BjE36S" now serving: () 
void Akonadi::Server::NotificationSource::serviceUnregistered(const QString&) Notification source "akonadi_mailfilter_agent_13955_MoYldw" now serving: () 
void Akonadi::Server::NotificationSource::serviceUnregistered(const QString&) Notification source "akonadi_mailfilter_agent_13955_ww7KsK" now serving: () 
void Akonadi::Server::NotificationSource::serviceUnregistered(const QString&) Notification source "akonadi_mailfilter_agent_13955_PrOt6z" now serving: () 
KCrash: Application 'akonadi_mailfilter_agent' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
KCrash: Connect sock_file=/home/flo/.kde/socket-flinkpad/kdeinit4__0
Comment 5 Florian Kraus 2015-01-03 17:52:57 UTC
The "crash window" gives a different error message now:

Application: Agent zur E-Mail-Filterung (akonadi_mailfilter_agent), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[KCrash Handler]
#5  0x00007f04cc429c3c in ?? () from /usr/lib/libakonadi-kde.so.4
#6  0x00007f04cbd31f4c in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7  0x00007f04cbd36513 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#8  0x00007f04ca46129c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#9  0x00007f04ca467da8 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#10 0x00007f04ccef82ca in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#11 0x00007f04cbd1cf8d in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#12 0x00007f04cbd4eb6b in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#13 0x00007f04cbd4bb91 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#14 0x00007f04c0d89c5d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007f04c0d89f48 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007f04c0d89ffc in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007f04cbd4c4ed in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#18 0x00007f04ca505b96 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#19 0x00007f04cbd1bae1 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#20 0x00007f04cbd1be45 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#21 0x00007f04cc8f85c3 in KJob::exec() () from /usr/lib/libkdecore.so.5
#22 0x00007f04cda9c30b in ?? () from /usr/lib/libmailcommon.so.4
#23 0x00007f04cda9fe16 in ?? () from /usr/lib/libmailcommon.so.4
#24 0x00007f04cdaa159e in MailCommon::SearchPattern::matches(Akonadi::Item const&, bool) const () from /usr/lib/libmailcommon.so.4
#25 0x000000000040ea1a in _start ()
Comment 6 Florian Kraus 2015-01-03 18:01:39 UTC
Sorry for so many consecutive posts, but I got even more output by installing kdepim-dbg, too.

Application: Agent zur E-Mail-Filterung (akonadi_mailfilter_agent), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[KCrash Handler]
#6  deref (this=0x1e00000001) at /usr/include/qt4/QtCore/qatomic_x86_64.h:133
#7  operator= (l=..., this=0x198b250) at /usr/include/qt4/QtCore/qlist.h:442
#8  QList<Akonadi::Item>::clear (this=0x198b250) at /usr/include/qt4/QtCore/qlist.h:766
#9  0x00007f027d8abf4c in QMetaObject::activate (sender=0x1b37ae0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3567
#10 0x00007f027d8b0513 in QObject::event (this=0x1b37ae0, e=<optimized out>) at kernel/qobject.cpp:1253
#11 0x00007f027bfdb29c in QApplicationPrivate::notify_helper (this=this@entry=0x1693d60, receiver=receiver@entry=0x1b37ae0, e=e@entry=0x7fffa4788390) at kernel/qapplication.cpp:4570
#12 0x00007f027bfe1da8 in QApplication::notify (this=this@entry=0x7fffa47886a0, receiver=receiver@entry=0x1b37ae0, e=e@entry=0x7fffa4788390) at kernel/qapplication.cpp:4356
#13 0x00007f027ea722ca in KApplication::notify (this=0x7fffa47886a0, receiver=0x1b37ae0, event=0x7fffa4788390) at ../../kdeui/kernel/kapplication.cpp:311
#14 0x00007f027d896f8d in QCoreApplication::notifyInternal (this=0x7fffa47886a0, receiver=0x1b37ae0, event=event@entry=0x7fffa4788390) at kernel/qcoreapplication.cpp:955
#15 0x00007f027d8c8b6b in sendEvent (event=0x7fffa4788390, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#16 QTimerInfoList::activateTimers (this=0x1693f60) at kernel/qeventdispatcher_unix.cpp:621
#17 0x00007f027d8c5b91 in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:186
#18 0x00007f0272903c5d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007f0272903f48 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007f0272903ffc in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00007f027d8c64ed in QEventDispatcherGlib::processEvents (this=0x1610b20, flags=...) at kernel/qeventdispatcher_glib.cpp:425
#22 0x00007f027c07fb96 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#23 0x00007f027d895ae1 in QEventLoop::processEvents (this=this@entry=0x7fffa4788610, flags=...) at kernel/qeventloop.cpp:149
#24 0x00007f027d895e45 in QEventLoop::exec (this=this@entry=0x7fffa4788610, flags=...) at kernel/qeventloop.cpp:204
#25 0x00007f027d89b8b9 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1227
#26 0x00007f027bfd973c in QApplication::exec () at kernel/qapplication.cpp:3828
#27 0x00007f027dee96ac in Akonadi::AgentBase::init (r=r@entry=0x17e8d50) at ../../akonadi/agentbase.cpp:859
#28 0x0000000000418e7e in Akonadi::AgentBase::init<MailFilterAgent> (argc=<optimized out>, argv=<optimized out>) at /usr/include/akonadi/agentbase.h:455
#29 0x00007f027b56bb45 in __libc_start_main (main=0x40bc80 <main(int, char**)>, argc=3, argv=0x7fffa47887b8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffa47887a8) at libc-start.c:287
#30 0x000000000040bcae in _start ()
Comment 7 Laurent Montel 2015-01-03 19:58:22 UTC
Thanks
it's the full test from this dialogbox ?
Comment 8 Florian Kraus 2015-01-03 23:04:00 UTC
(In reply to Laurent Montel from comment #7)
> Thanks
> it's the full test from this dialogbox ?

yes, that's all.
Comment 9 Laurent Montel 2015-02-03 06:43:29 UTC
 Could you give me the exact filter config that you use
(filter name etc.)
I need to reproduce it.

Or you can export specific filter as text so I can see which filter you use
thanks
Comment 10 Florian Kraus 2015-02-03 12:02:20 UTC
Unfortunately I am not any longer using kmail.
I remember that it was enough to add a filter with the criterion "Contact is in my adress book" and run it.
Comment 11 Denis Kurz 2016-09-24 20:39:57 UTC
This bug has only been reported for versions older than KDEPIM 4.14 (at most akonadi-1.3). Can anyone tell if this bug still present?

If noone confirms this bug for a recent version of akonadi (part of KDE Applications 15.08 or later), it gets closed in about three months.
Comment 12 Denis Kurz 2017-01-07 22:39:00 UTC
Just as announced in my last comment, I close this bug. If you encounter it again in a recent version (at least 5.0 aka 15.08), please open a new one unless it already exists. Thank you for all your input.