Bug 247456 - Akonadi IMAP resource crashed, when moving a message in KMail2 to another folder
Summary: Akonadi IMAP resource crashed, when moving a message in KMail2 to another folder
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: IMAP resource (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: Kevin Ottens
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-12 02:38 UTC by Elias Probst
Modified: 2011-04-08 00:57 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
New crash information added by DrKonqi (5.54 KB, text/plain)
2011-01-04 16:30 UTC, Christoph Herrmann
Details
New crash information added by DrKonqi (5.53 KB, text/plain)
2011-03-26 13:48 UTC, Christoph Herrmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elias Probst 2010-08-12 02:38:09 UTC
Application: akonadi_imap_resource (0.1)
KDE Platform Version: 4.5.00 (KDE 4.5.0)
Qt Version: 4.6.3
Operating System: Linux 2.6.35 x86_64
Distribution (Platform): Gentoo Packages

-- Information about the crash:
- What I was doing when the application crashed:

* Selected a message in my inbox in KMail2 (4.5.0 SVN)
* Pressed 'm' to open the 'Move to folder' dialog
* Typed 'SPAM-L' to filter for the 'SPAM-Learn' folder
* Selected the 'SPAM-Learn' folder
* Confirmed the dialog

Approximately 15 seconds later (working on a slow Internet connection), the KDE Crashhandler dialog appeared with the following backtrace.

-- Backtrace:
Application: Akonadi Resource (akonadi_imap_resource), signal: Segmentation fault
[Current thread is 1 (Thread 0x7fc07afb2760 (LWP 897))]

Thread 2 (Thread 0x7fc06686f710 (LWP 9032)):
#0  0x00007fc07a4c0edb in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#1  0x00007fc07a49a124 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#2  0x00007fc07a49a46f in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#3  0x00007fc07a3bd5b7 in QThread::exec() () from /usr/lib64/qt4/libQtCore.so.4
#4  0x00007fc0791b647d in KIMAP::SessionThread::run (this=0xc9a9b0) at /var/tmp/portage/kde-base/kdepimlibs-4.5.0/work/kdepimlibs-4.5.0/kimap/sessionthread.cpp:167
#5  0x00007fc07a3bf8b1 in QThreadPrivate::start(void*) () from /usr/lib64/qt4/libQtCore.so.4
#6  0x00007fc0765034d7 in start_thread () from /lib/libpthread.so.0
#7  0x00007fc076c4128d in clone () from /lib/libc.so.6

Thread 1 (Thread 0x7fc07afb2760 (LWP 897)):
[KCrash Handler]
#6  0x00007fc0791bcbc6 in QByteArray (this=0x89c560, response=...) at /usr/include/qt4/QtCore/qbytearray.h:420
#7  KIMAP::Message::Part::toString (this=0x89c560, response=...) at /var/tmp/portage/kde-base/kdepimlibs-4.5.0/work/kdepimlibs-4.5.0/kimap/message_p.h:42
#8  KIMAP::CopyJob::handleResponse (this=0x89c560, response=...) at /var/tmp/portage/kde-base/kdepimlibs-4.5.0/work/kdepimlibs-4.5.0/kimap/copyjob.cpp:127
#9  0x00007fc0791b480c in KIMAP::SessionPrivate::responseReceived (this=0x1849010, response=...) at /var/tmp/portage/kde-base/kdepimlibs-4.5.0/work/kdepimlibs-4.5.0/kimap/session.cpp:253
#10 0x00007fc0791b5577 in KIMAP::Session::qt_metacall (this=0xc5acf0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x9e54c0)
    at /var/tmp/portage/kde-base/kdepimlibs-4.5.0/work/kdepimlibs-4.5.0_build/kimap/session.moc:106
#11 0x00007fc07a4a9c5e in QObject::event(QEvent*) () from /usr/lib64/qt4/libQtCore.so.4
#12 0x00007fc0798ca486 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#13 0x00007fc0798d0f44 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/qt4/libQtGui.so.4
#14 0x00007fc077ad7374 in KApplication::notify (this=0x7fff6756a450, receiver=0xc5acf0, event=0x9ebba0) at /var/tmp/portage/kde-base/kdelibs-4.5.0/work/kdelibs-4.5.0/kdeui/kernel/kapplication.cpp:310
#15 0x00007fc07a49b464 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/qt4/libQtCore.so.4
#16 0x00007fc07a49d8f0 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/qt4/libQtCore.so.4
#17 0x00007fc07a4c12c3 in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () from /usr/lib64/qt4/libQtCore.so.4
#18 0x00007fc0759bb43a in g_main_dispatch (context=0x6899f0) at gmain.c:1960
#19 IA__g_main_context_dispatch (context=0x6899f0) at gmain.c:2513
#20 0x00007fc0759bea61 in g_main_context_iterate (context=0x6899f0, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>) at gmain.c:2591
#21 0x00007fc0759bec1e in IA__g_main_context_iteration (context=0x6899f0, may_block=1) at gmain.c:2654
#22 0x00007fc07a4c0ec4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#23 0x00007fc07996bb96 in QGuiEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtGui.so.4
#24 0x00007fc07a49a124 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#25 0x00007fc07a49a46f in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#26 0x00007fc07a49db3e in QCoreApplication::exec() () from /usr/lib64/qt4/libQtCore.so.4
#27 0x00007fc07ab3a27c in Akonadi::ResourceBase::init (r=0x7da200) at /var/tmp/portage/kde-base/kdepimlibs-4.5.0/work/kdepimlibs-4.5.0/akonadi/resourcebase.cpp:245
#28 0x00000000004165bf in Akonadi::ResourceBase::init<ImapResource> (argc=<value optimized out>, argv=<value optimized out>) at /usr/include/akonadi/resourcebase.h:186
#29 main (argc=<value optimized out>, argv=<value optimized out>) at /var/tmp/portage/kde-base/kdepim-runtime-4.4.92/work/kdepim-runtime-4.4.92/resources/imap/imapresource.cpp:2068

Reported using DrKonqi
Comment 1 Elias Probst 2010-08-12 11:35:44 UTC
I can reproduce this bug.
The only way to get rid of the crashes of the IMAP resource, is removing it completely from Akonadi and creating a new one again.

It happens always after moving a message in KMail2.
Comment 2 Elias Probst 2010-08-12 13:41:05 UTC
Probably helpful information: The message is moved within folders of the same resource, not from the IMAP resource to another one.
Comment 3 Christoph Herrmann 2011-01-04 16:30:10 UTC
Created attachment 55566 [details]
New crash information added by DrKonqi

akonadi_imap_resource (0.1) on KDE Platform 4.5.90 (4.6 RC1) using Qt 4.7.0

- What I was doing when the application crashed:

Moving a message from the inbox to a subfolder of the same imap resource

-- Backtrace (Reduced):
#6  0x00007f6d5f1f0b16 in QByteArray (this=0x1bd8200, response=...) at /usr/include/qt4/QtCore/qbytearray.h:421
#7  toString (this=0x1bd8200, response=...) at ../../kimap/message_p.h:42
#8  KIMAP::CopyJob::handleResponse (this=0x1bd8200, response=...) at ../../kimap/copyjob.cpp:127
#9  0x00007f6d5f1e7255 in KIMAP::SessionPrivate::responseReceived (this=0x1abf150, response=...) at ../../kimap/session.cpp:263
#10 0x00007f6d5f1e7fe2 in KIMAP::Session::qt_metacall (this=0x1a8caf0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x1e57250) at ./session.moc:106
Comment 4 Christoph Herrmann 2011-03-26 13:48:26 UTC
Created attachment 58354 [details]
New crash information added by DrKonqi

akonadi_imap_resource (0.1) on KDE Platform 4.6.1 (4.6.1) using Qt 4.7.0

- What I was doing when the application crashed:
 Deleting a message into the trash folder on my imap server

-- Backtrace (Reduced):
#6  0x00007f025d1c8b16 in QByteArray (this=0x2205980, response=...) at /usr/include/qt4/QtCore/qbytearray.h:421
#7  toString (this=0x2205980, response=...) at ../../kimap/message_p.h:42
#8  KIMAP::CopyJob::handleResponse (this=0x2205980, response=...) at ../../kimap/copyjob.cpp:127
#9  0x00007f025d1bf255 in KIMAP::SessionPrivate::responseReceived (this=0x206b370, response=...) at ../../kimap/session.cpp:263
#10 0x00007f025d1bffe2 in KIMAP::Session::qt_metacall (this=0x206b230, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7f02440c8b30) at ./session.moc:106
Comment 5 Sergio Martins 2011-04-06 01:28:20 UTC
Valgrinding done by eliasp:

==17404== Invalid read of size 8
==17404==    at 0x68E4F26: KIMAP::CopyJob::handleResponse(KIMAP::Message const&) (qbytearray.h:421)
==17404==    by 0x68DC4D7: KIMAP::SessionPrivate::responseReceived(KIMAP::Message const&) (session.cpp:271)
==17404==    by 0x68DD260: KIMAP::Session::qt_metacall(QMetaObject::Call, int, void**) (session.moc:113)
==17404==    by 0x5623D19: QObject::event(QEvent*) (qobject.cpp:1211)
==17404==    by 0x5B04744: QApplicationPrivate::notify_helper(QObject*, QEvent*) (qapplication.cpp:4445)
==17404==    by 0x5B092E1: QApplication::notify(QObject*, QEvent*) (qapplication.cpp:4324)
==17404==    by 0x809721B: KApplication::notify(QObject*, QEvent*) (kapplication.cpp:311)
==17404==    by 0x56139FD: QCoreApplication::notifyInternal(QObject*, QEvent*) (qcoreapplication.cpp:732)
==17404==    by 0x56165C3: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (qcoreapplication.h:215)
==17404==    by 0x563BE3D: postEventSourceDispatch(_GSource*, int (*)(void*), void*) (qcoreapplication.h:220)
==17404==    by 0xA150CD9: g_main_context_dispatch (gmain.c:2149)
==17404==    by 0xA1543A0: g_main_context_iterate (gmain.c:2780)
==17404==  Address 0x17c00220 is 8 bytes after a block of size 40 alloc'd
==17404==    at 0x4C2622A: malloc (vg_replace_malloc.c:236)
==17404==    by 0x55518E8: QListData::detach_grow(int*, int) (qlist.cpp:85)
==17404==    by 0x68E0508: QList<KIMAP::Message::Part>::append(KIMAP::Message::Part const&) (qlist.h:664)
==17404==    by 0x68DEF1D: KIMAP::SessionThread::readMessage() (qlist.h:321)
==17404==    by 0x68DF519: KIMAP::SessionThread::qt_metacall(QMetaObject::Call, int, void**) (sessionthread_p.moc:99)
==17404==    by 0x5623D19: QObject::event(QEvent*) (qobject.cpp:1211)
==17404==    by 0x5B04744: QApplicationPrivate::notify_helper(QObject*, QEvent*) (qapplication.cpp:4445)
==17404==    by 0x5B092E1: QApplication::notify(QObject*, QEvent*) (qapplication.cpp:4324)
==17404==    by 0x809721B: KApplication::notify(QObject*, QEvent*) (kapplication.cpp:311)
==17404==    by 0x56139FD: QCoreApplication::notifyInternal(QObject*, QEvent*) (qcoreapplication.cpp:732)
==17404==    by 0x56165C3: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (qcoreapplication.h:215)
==17404==    by 0x563BE3D: postEventSourceDispatch(_GSource*, int (*)(void*), void*) (qcoreapplication.h:220)
Comment 6 Elias Probst 2011-04-07 04:20:04 UTC
sergio provided this patch on #akonadi:

diff --git a/kimap/copyjob.cpp b/kimap/copyjob.cpp
index f13ce74..de41458 100644
--- a/kimap/copyjob.cpp
+++ b/kimap/copyjob.cpp
@@ -123,7 +123,7 @@ void CopyJob::handleResponse( const Message &response )
         it != response.responseCode.end(); ++it ) {
     if ( it->toString()=="COPYUID" ) {
       it = it + 3;
-      if ( it != response.responseCode.end() ) {
+      if ( it < response.responseCode.end() ) {
         d->resultingUids = ImapSet::fromImapSequenceSet( it->toString() );
       }
       break;

This patch fixes the issue for me - please review and commit it.
Comment 7 Sergio Martins 2011-04-08 00:54:01 UTC
Git commit 4ece14886807bc61a78f82b2919d7d8857e61e53 by Sergio Martins.
Committed on 08/04/2011 at 01:57.
Pushed by smartins into branch 'master'.

Don't segfault.

No unittest because i can't reproduce the crash with my imap server, but kevin acked the patch.

BUG: 247456

M  +1    -1    kimap/copyjob.cpp     

http://commits.kde.org/kdepimlibs/4ece14886807bc61a78f82b2919d7d8857e61e53
Comment 8 Sergio Martins 2011-04-08 00:57:40 UTC
Git commit 078ad4b1980c2ff72816600ee3defff8f3b88de6 by Sergio Martins.
Committed on 08/04/2011 at 01:57.
Pushed by smartins into branch '4.6'.

Don't segfault.

No unittest because i can't reproduce the crash with my imap server, but kevin acked the patch.

BUG: 247456
(cherry picked from commit 4ece14886807bc61a78f82b2919d7d8857e61e53)

M  +1    -1    kimap/copyjob.cpp     

http://commits.kde.org/kdepimlibs/078ad4b1980c2ff72816600ee3defff8f3b88de6