Bug 169048

Summary: Crashes when applying all filters on IMAP folder [KMail::ActionScheduler::actionMessage, KMail::ActionScheduler::filterMessage]
Product: [Unmaintained] kmail Reporter: Michal Vyskocil <michal.vyskocil>
Component: filteringAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED WORKSFORME    
Severity: crash CC: andrej.oresnik, andresbajotierra, angus, bmm.hoffmann, christophe, clement.cc, common, cool.chris65, crglasoe, dado, deadbabylon, denys, envite, florian.reinhard, getaceres, greg.martyn, hendrikl, info, info, jonathan, kde, kraeutert, lassi.vaatamoinen, michaell71, mike, ochach, otters73, paulmenchu, pfadfinder84, ralf, soft, tbe, th, thierry.chich, tigusoft.pl
Priority: NOR Keywords: triaged
Version: 1.10.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi
New crash information added by DrKonqi

Description Michal Vyskocil 2008-08-13 17:57:38 UTC
Version:            (using KDE 4.1.0)
Installed from:    SuSE RPMs
OS:                Linux

KMail crashes very often on applying of all filters in IMAP Inbox (sometimes during start). The crash log is

Aplikace: KMail (kmail), signál SIGSEGV
[?1034h[Thread debugging using libthread_db enabled]
[New Thread 0x7f72e799d700 (LWP 17764)]
[KCrash handler]
#5  KMail::ActionScheduler::actionMessage (this=0x14bf690, 
    res=<value optimized out>)
    at /usr/src/debug/kdepim-4.1.0/kmail/actionscheduler.cpp:668
#6  0x00007f72e70ddd3a in KMail::ActionScheduler::filterMessage (
    this=0x14bf690)
    at /usr/src/debug/kdepim-4.1.0/kmail/actionscheduler.cpp:641
#7  0x00007f72e70ddfba in KMail::ActionScheduler::qt_metacall (this=0x14bf690, 
    _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, 
    _a=0x7fffef9ed670)
    at /usr/src/debug/kdepim-4.1.0/build/kmail/actionscheduler.moc:123
#8  0x00007f72e0e8b4e0 in QMetaObject::activate ()
   from /usr/lib64/libQtCore.so.4
#9  0x00007f72e0e876e3 in QObject::event () from /usr/lib64/libQtCore.so.4
#10 0x00007f72dd14092d in QApplicationPrivate::notify_helper ()
   from /usr/lib64/libQtGui.so.4
#11 0x00007f72dd146cfa in QApplication::notify () from /usr/lib64/libQtGui.so.4
#12 0x00007f72e294ad1b in KApplication::notify () from /usr/lib64/libkdeui.so.5
#13 0x00007f72e0e79e9c in QCoreApplication::notifyInternal ()
   from /usr/lib64/libQtCore.so.4
#14 0x00007f72e0ea03c6 in ?? () from /usr/lib64/libQtCore.so.4
#15 0x00007f72e0ea0678 in QEventDispatcherUNIX::processEvents ()
   from /usr/lib64/libQtCore.so.4
#16 0x00007f72dd1c134a in ?? () from /usr/lib64/libQtGui.so.4
#17 0x00007f72e0e787f2 in QEventLoop::processEvents ()
   from /usr/lib64/libQtCore.so.4
#18 0x00007f72e0e78985 in QEventLoop::exec () from /usr/lib64/libQtCore.so.4
#19 0x00007f72e0e7aa25 in QCoreApplication::exec ()
   from /usr/lib64/libQtCore.so.4
#20 0x000000000040309b in main (argc=<value optimized out>, 
    argv=<value optimized out>)
    at /usr/src/debug/kdepim-4.1.0/kmail/main.cpp:146
#0  0x00007f72db656230 in nanosleep () from /lib64/libc.so.6

KMail is from KDE:KDE4:Factory:Desktop Build Service project.

rpm -qa | grep '\(kmail\|libqt4\)'
libqt4-sql-4.4.0-12.2
libqt4-4.4.0-12.2
libqt4-32bit-4.4.0-12.2
libqt4-x11-32bit-4.4.0-12.2
libqt4-qt3support-32bit-4.4.0-12.2
libqt4-qt3support-4.4.0-12.2
libqt4-x11-4.4.0-12.2
kde4-kmail-4.1.0-29.9
Comment 1 Michal Vyskocil 2008-08-13 18:07:36 UTC
Well, Kmail crashes only on e-mails related to jpackage.org project. The jpackage related filters:

[Filter #0]
Applicability=0
AutomaticName=false
ConfigureShortcut=false
ConfigureToolbar=false
Icon=
StopProcessingHere=true
ToolbarName=<List-Id>:<jpackage-discuss.zarb.org>
accounts-set=
actions=0
apply-on=check-mail,manual-filtering
contentsA=<jpackage-discuss.zarb.org>
fieldA=List-Id
funcA=contains
name=<List-Id>:<jpackage-discuss.zarb.org>
operator=and
rules=1

[Filter #1]
Applicability=0
AutomaticName=false
ConfigureShortcut=false
ConfigureToolbar=false
Icon=
StopProcessingHere=true
ToolbarName=<List-Id>:<jpackage-announce.zarb.org>
accounts-set=
action-args-0=.153180536.directory/.INBOX.directory/.jpackage.directory/announce
action-name-0=transfer
actions=1
apply-on=check-mail,manual-filtering
contentsA=<jpackage-announce.zarb.org>
fieldA=List-Id
funcA=contains
name=<List-Id>:<jpackage-announce.zarb.org>
operator=and
rules=1

[Filter #2]
Applicability=0
AutomaticName=false
ConfigureShortcut=false
ConfigureToolbar=false
Icon=
StopProcessingHere=true
ToolbarName=<List-Id>: <jpackage-bugs.zarb.org>
accounts-set=
action-args-0=.153180536.directory/.INBOX.directory/.jpackage.directory/announce
action-name-0=transfer
actions=1
apply-on=check-mail,manual-filtering
contentsA=<jpackage-bugs.zarb.org>
fieldA=List-Id
funcA=contains
name=<List-Id>: <jpackage-bugs.zarb.org>
operator=and
rules=1

[Filter #3]
Applicability=0
AutomaticName=false
ConfigureShortcut=true
ConfigureToolbar=false
Icon=
StopProcessingHere=true
ToolbarName=<List-Id>:<jpackage-discuss.zarb.org>
accounts-set=
action-args-0=.153180536.directory/.INBOX.directory/.jpackage.directory/discuss
action-name-0=transfer
actions=1
apply-on=check-mail,manual-filtering
contentsA=<jpackage-discuss.zarb.org>
contentsB=<jpackage-bugs.zarb.org>
contentsC=<jpackage-discuss.zarb.org>
fieldA=List-Id
fieldB=List-Id
fieldC=List-Id
funcA=contains
funcB=contains
funcC=contains
name=<List-Id>:<jpackage-discuss.zarb.org>
operator=or
rules=3

[General]
filters=4
Comment 2 Dario Andres 2009-02-12 21:41:21 UTC
*** Bug 184043 has been marked as a duplicate of this bug. ***
Comment 3 Christophe Marin 2009-03-09 23:42:29 UTC
BT from trunk :

Application: KMail (kmail), signal SIGSEGV
[?1034h[Thread debugging using libthread_db enabled]
[Current thread is 1 (Thread 0xb3a47710 (LWP 6010))]

Thread 1 (Thread 0xb3a47710 (LWP 6010)):
[KCrash Handler]
#6  0x082cafc0 in ?? ()
#7  0xb7471407 in KMail::ActionScheduler::filterMessage (this=0x88f2d40) at /home/krop/kde/src/KDE/kdepim/kmail/actionscheduler.cpp:642
#8  0xb7471ed6 in KMail::ActionScheduler::qt_metacall (this=0x88f2d40, _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0xbf99f358) at /home/krop/kde/build/KDE/kdepim/kmail/actionscheduler.moc:124
#9  0xb6a93c88 in QMetaObject::activate (sender=0x8107728, from_signal_index=4, to_signal_index=4, argv=0x0) at kernel/qobject.cpp:3069
#10 0xb6a95412 in QMetaObject::activate (sender=0x8107728, m=0xb6b74904, local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3143
#11 0xb6acfa87 in QTimer::timeout (this=0x8107728) at .moc/release-shared/moc_qtimer.cpp:128
#12 0xb6a9974e in QTimer::timerEvent (this=0x8107728, e=0xbf99f800) at kernel/qtimer.cpp:261
#13 0xb6a8e12f in QObject::event (this=0x8107728, e=0xbf99f800) at kernel/qobject.cpp:1082
#14 0xb5f2ceec in QApplicationPrivate::notify_helper (this=0x8072750, receiver=0x8107728, e=0xbf99f800) at kernel/qapplication.cpp:4084
#15 0xb5f351ae in QApplication::notify (this=0xbf99fb50, receiver=0x8107728, e=0xbf99f800) at kernel/qapplication.cpp:3631
#16 0xb7d8396d in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#17 0xb6a7d9db in QCoreApplication::notifyInternal (this=0xbf99fb50, receiver=0x8107728, event=0xbf99f800) at kernel/qcoreapplication.cpp:602
#18 0xb6aad026 in QTimerInfoList::activateTimers (this=0x8074904) at kernel/qcoreapplication.h:213
#19 0xb6aa94d0 in timerSourceDispatch (source=0x80748d0) at kernel/qeventdispatcher_glib.cpp:164
#20 0xb41f89a8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#21 0xb41fc063 in ?? () from /usr/lib/libglib-2.0.so.0
#22 0xb41fc221 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#23 0xb6aa9428 in QEventDispatcherGlib::processEvents (this=0x806db88, flags={i = -1080428120}) at kernel/qeventdispatcher_glib.cpp:323
#24 0xb5fccac5 in QGuiEventDispatcherGlib::processEvents (this=0x806db88, flags={i = -1080428072}) at kernel/qguieventdispatcher_glib.cpp:202
#25 0xb6a7bffa in QEventLoop::processEvents (this=0xbf99fa50, flags={i = -1080428008}) at kernel/qeventloop.cpp:149
#26 0xb6a7c43a in QEventLoop::exec (this=0xbf99fa50, flags={i = -1080427944}) at kernel/qeventloop.cpp:200
#27 0xb6a7e8e9 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:880
#28 0xb5f2cd67 in QApplication::exec () at kernel/qapplication.cpp:3553
#29 0x0804aa48 in main (argc=3, argv=0xbf99fc24) at /home/krop/kde/src/KDE/kdepim/kmail/main.cpp:146
Comment 4 Ruchir Brahmbhatt 2009-04-10 12:23:43 UTC
Thanks for providing details of filters. Can you please attach few problematic mails as well?
Comment 5 Michal Vyskocil 2009-04-16 09:10:16 UTC
I switched from Kmail's filtering to Sieve scripts on server, but I tried to recheck it. But I was unable to reproduce it under current version of kmail. With a same set of filtering rules, kmail works well.

KMail
Version 1.11.2
Using KDE 4.2.2 (KDE 4.2.2) "release 1"
Comment 6 Ruchir Brahmbhatt 2009-04-16 10:42:06 UTC
@Michal: Thanks for your feedback. I'm closing this bug for now. Please feel free to reopen if you can reproduce it again.
Comment 7 Dario Andres 2009-05-17 22:59:55 UTC
*** Bug 187526 has been marked as a duplicate of this bug. ***
Comment 8 Christophe Marin 2009-06-14 16:01:33 UTC
*** Bug 196489 has been marked as a duplicate of this bug. ***
Comment 9 Christophe Marin 2009-07-20 21:59:03 UTC
*** Bug 200926 has been marked as a duplicate of this bug. ***
Comment 10 Christophe Marin 2009-09-02 00:10:17 UTC
*** Bug 205877 has been marked as a duplicate of this bug. ***
Comment 11 Greg Martyn 2009-09-08 16:32:35 UTC
I get this backtrace all the time. I see the same backtrace in an older report though: 164448

*** This bug has been marked as a duplicate of bug 164448 ***
Comment 12 Greg Martyn 2009-09-08 16:41:48 UTC
Oops.. sorry. In the backtrace from #6 on they're the same but #5 is different. Comment #3 doesn't show that line though.

This is the bug I experience -- not 164448.
Comment 13 Christophe Marin 2009-09-10 13:56:51 UTC
*** Bug 206954 has been marked as a duplicate of this bug. ***
Comment 14 Christophe Marin 2009-09-16 13:18:18 UTC
*** Bug 207567 has been marked as a duplicate of this bug. ***
Comment 15 Dario Andres 2009-10-17 21:59:46 UTC
From bug 210764:
-
What I was doing when the application crashed:
I just have had a new rule in order to filter my email.  For this rule, on the
email matching this rule, there is a crash when I apply filters manually. 
Kmail don't crash on other rules.
-
I know a little more about the context. When I have added my new filter, i have
created one with the right-click on the message. But after that, I have copied
the sender and add it to an another already existant rule.
An incomplete rule was then staying at the begining of the list of rules.
Comment 16 Dario Andres 2009-10-17 21:59:53 UTC
*** Bug 210764 has been marked as a duplicate of this bug. ***
Comment 17 Christophe Marin 2009-10-23 09:39:15 UTC
*** Bug 211507 has been marked as a duplicate of this bug. ***
Comment 18 Christophe Marin 2009-11-17 07:09:01 UTC
*** Bug 214924 has been marked as a duplicate of this bug. ***
Comment 19 Christophe Marin 2009-11-18 13:43:53 UTC
*** Bug 215012 has been marked as a duplicate of this bug. ***
Comment 20 Ralf Kleineisel 2009-12-08 09:35:20 UTC
This bugs exists in the current Fedora 12 kdepim package, too.

I use KMail 1.23.1 from the kdepim-4.3.3-1.fc12.i686 package. KMail crashes several times a day when it tries to apply the filters to new mails.

Here is the backtrace:

Application: KMail (kmail), signal: Segmentation fault
[KCrash Handler]
#6  contains (t=<value optimized out>, this=0xb04) at /usr/include/QtCore/qlist.h:667
#7  KMFilter::applyOnAccount (t=<value optimized out>, this=0xb04) at /usr/src/debug/kdepim-4.3.3/kmail/kmfilter.cpp:217
#8  0x009f4b62 in KMail::ActionScheduler::filterMessage (this=<value optimized out>) at /usr/src/debug/kdepim-4.3.3/kmail/actionscheduler.cpp:628
#9  0x009f4f54 in KMail::ActionScheduler::qt_metacall (this=<value optimized out>, _c=<value optimized out>, _id=17, _a=<value optimized out>)
    at /usr/src/debug/kdepim-4.3.3/i686-redhat-linux-gnu/kmail/actionscheduler.moc:124
#10 0x03b4cc0c in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQtCore.so.4
#11 0x03b4d843 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#12 0x03b872f8 in QTimer::timeout() () from /usr/lib/libQtCore.so.4
#13 0x03b5232e in QTimer::timerEvent(QTimerEvent*) () from /usr/lib/libQtCore.so.4
#14 0x03b46d3f in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#15 0x0443cb24 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#16 0x04444281 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#17 0x065fe02b in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#18 0x03b36d73 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#19 0x03b642be in ?? () from /usr/lib/libQtCore.so.4
#20 0x03b61c21 in ?? () from /usr/lib/libQtCore.so.4
#21 0x0130f118 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#22 0x01312a48 in ?? () from /lib/libglib-2.0.so.0
#23 0x01312b74 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#24 0x03b61b6d in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#25 0x044dc356 in ?? () from /usr/lib/libQtGui.so.4
#26 0x03b352aa in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#27 0x03b3570a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#28 0x03b37bf7 in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#29 0x0443c9a8 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#30 0x0804a59e in main (argc=<value optimized out>, argv=<value optimized out>) at /usr/src/debug/kdepim-4.3.3/kmail/main.cpp:146
Comment 21 Dario Andres 2009-12-24 14:20:45 UTC
From bug 219926:
---
What I was doing when the application crashed:
Kmail crash randomly when filtering mail on one of my imap accounts. This
happens most the time on first start/check, but even when I manually apply all
filter to the rest of the mails in the inbox. A few crashes later I could
filter all mails and then kmail seems to stable for the rest of the day.

Updated backtrace:
---
Thread 1 (Thread 0x7fe12e56f840 (LWP 16135)):
[KCrash Handler]
#5  KMail::ActionScheduler::actionMessage (this=0x2298330, res=<value optimized
out>) at /usr/src/debug/kdepim-4.3.4/kmail/actionscheduler.cpp:675
#6  0x00007fe12029b4a9 in KMail::ActionScheduler::filterMessage
(this=0x2298330) at /usr/src/debug/kdepim-4.3.4/kmail/actionscheduler.cpp:648
#7  0x00007fe12029b864 in KMail::ActionScheduler::qt_metacall (this=0x2298330,
_c=InvokeMetaMethod, _id=17, _a=0x7fffcbf4f740)
    at
/usr/src/debug/kdepim-4.3.4/x86_64-redhat-linux-gnu/kmail/actionscheduler.moc:124
#8  0x000000370835408c in QMetaObject::activate(QObject*, int, int, void**) ()
from /usr/lib64/libQtCore.so.4
...

Bug 219926 also contains some config files and a testcase email.
Comment 22 Dario Andres 2009-12-24 14:20:48 UTC
*** Bug 219926 has been marked as a duplicate of this bug. ***
Comment 23 Jonathan Thomas 2010-05-27 16:03:05 UTC
*** Bug 238884 has been marked as a duplicate of this bug. ***
Comment 24 Jonathan Thomas 2010-05-27 16:04:00 UTC
*** Bug 222004 has been marked as a duplicate of this bug. ***
Comment 25 Siu Chung (Clement) Cheung 2010-06-11 23:32:32 UTC
Hi,

This crash is due to you all having a rule with no actions but having "stop processing here" to make certain emails immune to subsequent rules. (see Michal's filter #1) Kmail currently chokes on that.

I have already debugged this crash and attached a fix in bug 169646. Please see comments and attachment there for full explanation of this crash. I notice now that the bug is already closed when I posted due to lack of feedback, which is probably why nobody noticed my patch. Sorry about that. Should have searched more.

Can someone try my patch and see if it works for you and maybe have someone from the kmail team take a look? There have been so many reports of this bug already. The crash is fully reproducible. But you must have *NEW* email matching the no action rule to trigger this crash. So if you rerun kmail immediately after the crash, it no longer happens due to the mail being no longer new. This is probably why people are saying the crash is "random". To reproduce the bug consistently, simply make a no action rule matching your own email address and send an email to yourself.

As a workaround, add a sound action to your empty rule. If you find the barrage of sound annoying, simply record one second of silence and use that as your "sound".
Comment 26 Christophe Marin 2010-06-21 11:15:52 UTC
*** Bug 242318 has been marked as a duplicate of this bug. ***
Comment 27 Jose 2010-06-22 10:06:50 UTC
Created attachment 48213 [details]
New crash information added by DrKonqi

I just defined a filter on an imap acount. Kontact crashed when an e-mail arrived. It doesn't crash always.
Comment 28 Jose 2010-06-22 10:13:13 UTC
Created attachment 48214 [details]
New crash information added by DrKonqi

Well, it always happens. The case is that I had a KDE 4.4.4 installation but it was upgraded from KDE 4.0.X to 4.4.4. I had some filters defined in kontact and it never crashed because of them. Then, I renamed the .kde directory because the configuration was messed for some applications and I started with a new .kde folder. I have configured everything but as it was expected, my old filters were forgotten. Now I've defined them again and it has started to crash, which it didn't do before.
Comment 29 Nicolas L. 2010-07-13 12:54:16 UTC
*** Bug 244425 has been marked as a duplicate of this bug. ***
Comment 30 Denys 2010-07-13 15:32:21 UTC
Reason of bug confirmed in my case. I had filter with empty actions, after i remove it - no more crash.
Comment 31 Nicolas L. 2010-07-26 16:06:20 UTC
*** Bug 245793 has been marked as a duplicate of this bug. ***
Comment 32 Björn Ruberg 2010-08-08 01:24:51 UTC
*** Bug 246480 has been marked as a duplicate of this bug. ***
Comment 33 mike 2010-08-13 02:14:59 UTC
Created attachment 50096 [details]
New crash information added by DrKonqi

KMail always crashes when filtering messages from an IMAP account. When applying filter manually, it crashes after going through about 10 or so messages. When receiving thousands of new messages, it always fails, but seems to get through 50-100 before it crashes. Doesn't fail on the same message twice; just applying all filters to one message at a time works fine.
Comment 34 mike 2010-08-16 21:19:58 UTC
Created attachment 50629 [details]
New crash information added by DrKonqi

Filtering IMAP messages, again. Always fails when applying the filter manually.
Again, < 100 messages to filter, crashes Kmail.
Comment 35 mike 2010-08-16 23:39:53 UTC
Created attachment 50633 [details]
New crash information added by DrKonqi

Seg fault upon applying all filters manually to less than ten messages. It's amazing how easy this is to make crash. Just select a few messages, apply all filters, and there's about a 99% chance Kmail will crash.
Comment 36 mike 2010-08-17 00:56:34 UTC
Created attachment 50636 [details]
New crash information added by DrKonqi

More crashing on filtering over IMAP. Had selected 3 messages to apply all filters to when this one happened. Makes using KMail essentially impossible.
Comment 37 mike 2010-08-17 01:41:07 UTC
Created attachment 50638 [details]
New crash information added by DrKonqi

This crash report may be useful as it occurred while applying all filters to just one message.
Perhaps less to sort through in this attached report.
Comment 38 Nicolas L. 2010-08-18 09:30:10 UTC
*** Bug 248180 has been marked as a duplicate of this bug. ***
Comment 39 Thomas Berger 2011-01-03 09:50:20 UTC
Created attachment 55505 [details]
New crash information added by DrKonqi

kontact (4.4.7) on KDE Platform 4.5.3 (KDE 4.5.3) using Qt 4.6.3

- What I was doing when the application crashed:

Kmail / Contact was filtering a huge count of mails on a imap folder (about 8.000 mails).

-- Backtrace (Reduced):
#6  0x00007fe4b9b524be in KMail::ActionScheduler::actionMessage(KMFilterAction::ReturnCode) () from /usr/lib/libkmailprivate.so.4
#7  0x00007fe4b9b530c8 in KMail::ActionScheduler::filterMessage() () from /usr/lib/libkmailprivate.so.4
#8  0x00007fe4b9b539f4 in KMail::ActionScheduler::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/libkmailprivate.so.4
[...]
#10 0x00007fe4d0699ad3 in QObject::event(QEvent*) () from /usr/lib64/qt4/libQtCore.so.4
#11 0x00007fe4d0db650c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
Comment 40 Christophe Marin 2011-02-10 11:25:01 UTC
*** Bug 263725 has been marked as a duplicate of this bug. ***
Comment 41 Christophe Marin 2011-02-10 11:25:18 UTC
*** Bug 263276 has been marked as a duplicate of this bug. ***
Comment 42 Christophe Marin 2011-02-10 11:25:30 UTC
*** Bug 265949 has been marked as a duplicate of this bug. ***
Comment 43 Christophe Marin 2011-02-10 11:26:31 UTC
*** Bug 169646 has been marked as a duplicate of this bug. ***
Comment 44 Christophe Marin 2011-02-10 11:27:55 UTC
from bug 169646:

This bug is still happening.

kmail 1.13.2
KDE 4.4.2
linux kernel 2.6.33-gentoo-r1 (x86_64)
Gentoo packages.

Interestingly, my other setup with 32-bit linux on Sabayon Linux doesn't crash
using exact same rule. Not sure why.

Backtrace:
Thread 1 (Thread 0x7f457240c750 (LWP 11155)):
[KCrash Handler]
#5  0x00007f4570dbfb62 in
KMail::ActionScheduler::actionMessage(KMFilterAction::ReturnCode) () from
/usr/lib64/libkmailprivate.so.4
#6  0x00007f4570dbfe1a in KMail::ActionScheduler::filterMessage() () from
/usr/lib64/libkmailprivate.so.4
#7  0x00007f4570dc05ba in
KMail::ActionScheduler::qt_metacall(QMetaObject::Call, int, void**) () from
/usr/lib64/libkmailprivate.so.4
#8  0x00007f456ccb7147 in QMetaObject::activate(QObject*, QMetaObject const*,
int, void**) () from /usr/lib64/qt4/libQtCore.so.4
#9  0x00007f456ccb3bd3 in QObject::event(QEvent*) () from
/usr/lib64/qt4/libQtCore.so.4

Liberal sprinkling of debug statements in the area reveals that the variable
"action" is pointing at 0x21, an invalid but non-zero address which passes the
mFilterAction check in actionMessage(). This causes a segfault when accessed
later.

How does that happen? Here's the current code that checks for the end of the
action list:
498      KMFilterAction *action = mFilterAction;
499     // mFilterAction = (*mFilterIt).actions()->next();
500     if ( ++mFilterActionIt == (*mFilterIt)->actions()->end() )
501     mFilterAction = 0;
502     else mFilterAction = (*mFilterActionIt);
503     action->processAsync( *mMessageIt );
504     }

The problem is we're checking if the *NEXT* action is the end. What about the
*CURRENT* one? Sure it's supposed to be already checked when we advance the
pointer there. Except that the first action isn't assigned by this iterator
advancing code. It's initialized in filterMessage():
      mFilterActionIt = (*mFilterIt)->actions()->begin();
      mFilterAction = (*mFilterActionIt);
      actionMessage();

What's happening here is that begin() == end() since the list is empty. We
didn't verify that mFilterActionIt isn't end (and therefore invalid) before
dereferencing it. Since this is an iterator, not a pointer, we won't crash --
yet. But mFilterAction will get random garbage. If said random garbage happens
to be non-zero, actionMessage() will then try to dereference it as a pointer
and hence the crash.


Suggested patch:

--- kmail/actionscheduler.cpp.orig	2010-04-16 19:03:55.853213672 -0700
+++ kmail/actionscheduler.cpp	2010-04-16 20:07:46.071964041 -0700
@@ -659,7 +659,7 @@ void ActionScheduler::actionMessage(KMFi
     mResult = ResultCriticalError;
     finish(); //must handle critical errors immediately
   }
-  if (mFilterAction) {
+  if (mFilterActionIt != (*mFilterIt)->actions()->end()) {
     KMMessage *msg = message( *mMessageIt );
     if (msg) {
       if ( FilterLog::instance()->isLogging() ) {
@@ -668,10 +668,7 @@ void ActionScheduler::actionMessage(KMFi
         FilterLog::instance()->add( logText, FilterLog::appliedAction );
       }
       KMFilterAction *action = mFilterAction;
-//      mFilterAction = (*mFilterIt).actions()->next();
-      if ( ++mFilterActionIt == (*mFilterIt)->actions()->end() )
-        mFilterAction = 0;
-      else mFilterAction = (*mFilterActionIt);
+      mFilterAction = *(++mFilterActionIt);
       action->processAsync( msg );
     }
   } else {

Suggested workaround:
As a temporary work around, people like me who need this to set a "stop
processing here" rule with no action and matching sender =
my_boss@my_company.com to make sure important messages doesn't get filtered can
assign a sound as action.

That action will have no effect except being extremely irritating when a whole
bunch of messages matching the rule arrives. This can be avoided by recording a
wav file of silence and using it as the action.
Comment 45 Christophe Marin 2011-02-14 11:07:08 UTC
*** Bug 265979 has been marked as a duplicate of this bug. ***
Comment 46 Christophe Marin 2011-02-23 17:20:35 UTC
*** Bug 266975 has been marked as a duplicate of this bug. ***
Comment 47 Christophe Marin 2011-02-23 17:26:57 UTC
*** Bug 266976 has been marked as a duplicate of this bug. ***
Comment 48 Christophe Marin 2011-02-24 20:44:48 UTC
*** Bug 267073 has been marked as a duplicate of this bug. ***
Comment 49 Christophe Marin 2011-02-24 20:45:04 UTC
*** Bug 267057 has been marked as a duplicate of this bug. ***
Comment 50 Christophe Marin 2011-02-24 20:45:19 UTC
*** Bug 267056 has been marked as a duplicate of this bug. ***
Comment 51 Christophe Marin 2011-03-01 18:27:55 UTC
*** Bug 267387 has been marked as a duplicate of this bug. ***
Comment 52 Christophe Marin 2011-03-02 22:00:06 UTC
*** Bug 267496 has been marked as a duplicate of this bug. ***
Comment 53 Chris 2011-03-03 20:14:20 UTC
Created attachment 57652 [details]
New crash information added by DrKonqi

kontact (4.4.10) on KDE Platform 4.5.5 (KDE 4.5.5) "release 1" using Qt 4.6.3

- What I was doing when the application crashed: I was out of the office.  When I returned I had this crash report.  So although this crash seems to be related to IMAP filtering I wasn't doing any filtering.  The filtering that should occur when email comes in does not happen.  Is that part of the issue?  in some variation of releases the filtering was turned off or not implemented correctly. . .

-- Backtrace (Reduced):
#6  KMail::ActionScheduler::actionMessage (this=0x1840f10, res=<value optimized out>) at /usr/src/debug/kdepim-4.4.10/kmail/actionscheduler.cpp:675
#7  0x00007ffac17ee6a5 in KMail::ActionScheduler::filterMessage (this=0x1840f10) at /usr/src/debug/kdepim-4.4.10/kmail/actionscheduler.cpp:648
#8  0x00007ffac17eea54 in KMail::ActionScheduler::qt_metacall (this=0x1840f10, _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0x7fff7cb72610)
    at /usr/src/debug/kdepim-4.4.10/build/kmail/actionscheduler.moc:130
[...]
#10 0x00007ffadb5a522e in QObject::event (this=0x20f0310, e=0x7fff7cb72db0) at kernel/qobject.cpp:1212
#11 0x00007ffada9854d4 in QApplicationPrivate::notify_helper (this=0x63d380, receiver=0x20f0310, e=0x7fff7cb72db0) at kernel/qapplication.cpp:4302
Comment 54 Christophe Marin 2011-03-11 11:43:01 UTC
*** Bug 268153 has been marked as a duplicate of this bug. ***
Comment 55 Christophe Marin 2011-03-11 11:43:20 UTC
*** Bug 268152 has been marked as a duplicate of this bug. ***
Comment 56 Christophe Marin 2011-03-11 11:43:32 UTC
*** Bug 268151 has been marked as a duplicate of this bug. ***
Comment 57 Christophe Marin 2011-03-11 18:45:39 UTC
*** Bug 268232 has been marked as a duplicate of this bug. ***
Comment 58 Christophe Marin 2011-03-11 18:45:45 UTC
*** Bug 268226 has been marked as a duplicate of this bug. ***
Comment 59 Christophe Marin 2011-03-11 18:49:48 UTC
*** Bug 268222 has been marked as a duplicate of this bug. ***
Comment 60 Christophe Marin 2011-03-14 15:07:57 UTC
*** Bug 268464 has been marked as a duplicate of this bug. ***
Comment 61 Christophe Marin 2011-03-14 15:34:08 UTC
*** Bug 268468 has been marked as a duplicate of this bug. ***
Comment 62 Christophe Marin 2011-03-15 15:55:31 UTC
*** Bug 268560 has been marked as a duplicate of this bug. ***
Comment 63 Christophe Marin 2011-03-15 16:05:37 UTC
Chris.. that almost the ~20th time you report the *exact* same crash. How about reading https://bugs.kde.org/show_bug.cgi?id=169048#c30 ?
Comment 64 Christophe Marin 2011-03-16 22:45:22 UTC
*** Bug 268677 has been marked as a duplicate of this bug. ***
Comment 65 Christophe Marin 2011-03-25 15:26:51 UTC
*** Bug 269389 has been marked as a duplicate of this bug. ***
Comment 66 Christophe Marin 2011-07-08 12:58:02 UTC
*** Bug 275631 has been marked as a duplicate of this bug. ***
Comment 67 Christophe Marin 2011-07-19 10:43:05 UTC
*** Bug 278076 has been marked as a duplicate of this bug. ***
Comment 68 bmm.hoffmann 2011-07-26 12:16:49 UTC
Created attachment 62204 [details]
New crash information added by DrKonqi

kontact (4.4.10) on KDE Platform 4.6.2 (4.6.2) using Qt 4.7.2

- What I was doing when the application crashed:

Try to filter all mails in gmail Inbox causes crash, each time

-- Backtrace (Reduced):
#7  KMail::ActionScheduler::actionMessage (this=0x9ff5f98, res=KMFilterAction::GoOn) at ../../kmail/actionscheduler.cpp:675
#8  0xb2f46757 in KMail::ActionScheduler::filterMessage (this=0x9ff5f98) at ../../kmail/actionscheduler.cpp:648
#9  0xb2f46b94 in KMail::ActionScheduler::qt_metacall (this=0x9ff5f98, _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0xbfbb70ec) at ./actionscheduler.moc:130
[...]
#12 0x041b52f7 in QTimer::timeout (this=0x9f5b648) at .moc/release-shared/moc_qtimer.cpp:134
#13 0x0416e3ee in QTimer::timerEvent (this=0x9f5b648, e=0xbfbb760c) at kernel/qtimer.cpp:271
Comment 69 Christophe Marin 2011-08-01 09:26:00 UTC
*** Bug 278543 has been marked as a duplicate of this bug. ***
Comment 70 Christophe Marin 2011-10-12 15:21:32 UTC
*** Bug 283817 has been marked as a duplicate of this bug. ***
Comment 71 Christophe Marin 2012-01-08 15:24:58 UTC
Closing with Worksforme. The filtering is now done by a dedicated Akonadi agent.
Comment 72 Jekyll Wu 2012-03-01 13:12:57 UTC
*** Bug 295124 has been marked as a duplicate of this bug. ***