Bug 275561

Summary: akonadi_mixedmaildir_resource crashes when fetching mail
Product: [Frameworks and Libraries] Akonadi Reporter: Juergen Spitzmueller <juergen>
Component: Mixed Maildir resourceAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: crash CC: broeksema, e.lazarides, edmondo, gerhard, krammer
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: New crash information added by DrKonqi

Description Juergen Spitzmueller 2011-06-13 16:36:42 UTC
Application: akonadi_mixedmaildir_resource (0.1)
KDE Platform Version: 4.6.4 (4.6.4)
Qt Version: 4.7.3
Operating System: Linux 2.6.37.6-0.5-desktop i686
Distribution: "openSUSE 11.4 (i586)"

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

Fetching mails in a KMail resource folder (POP3) triggers this crash (not always, but fairly frequently).

The crash can be reproduced some of the time.

-- Backtrace:
Application: Akonadi Resource (akonadi_mixedmaildir_resource), signal: Segmentation fault
[KCrash Handler]
#7  0xb5a43733 in memmove () from /lib/libc.so.6
#8  0xb71d168d in KMBox::MBox::purge (this=0x81f59e0, deletedEntries=..., movedEntries=0xbff95d48) at /usr/include/bits/string3.h:58
#9  0x0808319d in MBoxContext::purge (this=0x81f59d0, movedEntries=...) at /usr/src/debug/kdepim-runtime-4.6.0/resources/mixedmaildir/mixedmaildirstore.cpp:174
#10 0x0807e9f2 in MixedMaildirStore::Private::visit (this=0x81db060, job=0xbd8eb98) at /usr/src/debug/kdepim-runtime-4.6.0/resources/mixedmaildir/mixedmaildirstore.cpp:2112
#11 0xb77155f7 in Akonadi::FileStore::StoreCompactJob::accept (this=0xbd8eb98, visitor=0x81db060) at /usr/src/debug/kdepim-runtime-4.6.0/resources/shared/filestore/storecompactjob.cpp:54
#12 0x080686bc in MixedMaildirStore::processJob (this=0xffff3b7d, job=0xbd8eb98) at /usr/src/debug/kdepim-runtime-4.6.0/resources/mixedmaildir/mixedmaildirstore.cpp:2202
#13 0xb770ee76 in Akonadi::FileStore::AbstractLocalStore::Private::processJobs (this=0x81dac20, jobs=...) at /usr/src/debug/kdepim-runtime-4.6.0/resources/shared/filestore/abstractlocalstore.cpp:295
#14 0xb770eef8 in Akonadi::FileStore::AbstractLocalStore::qt_metacall (this=0x81007f8, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0xbff95f48) at /usr/src/debug/kdepim-runtime-4.6.0/build/resources/shared/filestore/abstractlocalstore.moc:75
#15 0xb5db107d in QMetaObject::metacall (object=0x81007f8, cl=QMetaObject::InvokeMetaMethod, idx=4, argv=0xbff95f48) at kernel/qmetaobject.cpp:237
#16 0xb5dc04cc in QMetaObject::activate (sender=0x81d3a48, m=0xb771dc3c, local_signal_index=0, argv=0xbff95f48) at kernel/qobject.cpp:3278
#17 0xb7714845 in Akonadi::FileStore::AbstractJobSession::jobsReady (this=0x81d3a48, _t1=...) at /usr/src/debug/kdepim-runtime-4.6.0/build/resources/shared/filestore/session_p.moc:85
#18 0xb7714d5e in runNextJob (this=0x81d3a48, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0xbff9604c) at /usr/src/debug/kdepim-runtime-4.6.0/resources/shared/filestore/sessionimpls.cpp:142
#19 Akonadi::FileStore::FiFoQueueJobSession::qt_metacall (this=0x81d3a48, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0xbff9604c) at /usr/src/debug/kdepim-runtime-4.6.0/build/resources/shared/filestore/sessionimpls_p.moc:73
#20 0xb5db107d in QMetaObject::metacall (object=0x81d3a48, cl=QMetaObject::InvokeMetaMethod, idx=5, argv=0xbff9604c) at kernel/qmetaobject.cpp:237
#21 0xb5dc04cc in QMetaObject::activate (sender=0x81dad08, m=0xb5ee55a4, local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3278
#22 0xb5e106a5 in QTimer::timeout (this=0x81dad08) at .moc/release-shared/moc_qtimer.cpp:134
#23 0xb5dc7856 in QTimer::timerEvent (this=0x81dad08, e=0xbff9658c) at kernel/qtimer.cpp:271
#24 0xb5dbfc04 in QObject::event (this=0x81dad08, e=0xbff9658c) at kernel/qobject.cpp:1181
#25 0xb62ce684 in QApplicationPrivate::notify_helper (this=0x80b5bd0, receiver=0x81dad08, e=0xbff9658c) at kernel/qapplication.cpp:4462
#26 0xb62d7427 in QApplication::notify (this=0xbff968d0, receiver=0x81dad08, e=0xbff9658c) at kernel/qapplication.cpp:3862
#27 0xb6d81cc1 in KApplication::notify (this=0xbff968d0, receiver=0x81dad08, event=0xbff9658c) at /usr/src/debug/kdelibs-4.6.4/kdeui/kernel/kapplication.cpp:311
#28 0xb5daa78e in QCoreApplication::notifyInternal (this=0xbff968d0, receiver=0x81dad08, event=0xbff9658c) at kernel/qcoreapplication.cpp:731
#29 0xb5ddbb89 in sendEvent (this=0x80b88a4) at kernel/qcoreapplication.h:215
#30 QTimerInfoList::activateTimers (this=0x80b88a4) at kernel/qeventdispatcher_unix.cpp:619
#31 0xb5dd8852 in timerSourceDispatch (source=0x80b8870) at kernel/qeventdispatcher_glib.cpp:184
#32 0xb50bc3d9 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#33 0xb50bcbe0 in ?? () from /lib/libglib-2.0.so.0
#34 0xb50bce9e in g_main_context_iteration () from /lib/libglib-2.0.so.0
#35 0xb5dd8f7b in QEventDispatcherGlib::processEvents (this=0x809c658, flags=...) at kernel/qeventdispatcher_glib.cpp:422
#36 0xb63851da in QGuiEventDispatcherGlib::processEvents (this=0x809c658, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#37 0xb5da9a6d in QEventLoop::processEvents (this=0xbff96834, flags=...) at kernel/qeventloop.cpp:149
#38 0xb5da9c99 in QEventLoop::exec (this=0xbff96834, flags=...) at kernel/qeventloop.cpp:201
#39 0xb5dae740 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1008
#40 0xb62cc3d4 in QApplication::exec () at kernel/qapplication.cpp:3736
#41 0xb7580e3f in Akonadi::ResourceBase::init (r=0x81d9ed0) at /usr/src/debug/kdepimlibs-4.6.4/akonadi/resourcebase.cpp:390
#42 0x0805ee83 in init<MixedMaildirResource> (argc=) at /usr/include/akonadi/resourcebase.h:188
#43 main (argc=) at /usr/src/debug/kdepim-runtime-4.6.0/resources/mixedmaildir/mixedmaildirresource.cpp:842

Reported using DrKonqi
Comment 1 Kevin Krammer 2011-06-13 17:25:22 UTC
Hmm, difficult to tell what actually went wrong since we don't have any indication which parameters were passed to the memmove() function.

Bertjan: could this be QFile::map() failing?

Juergen: unless you needs this folder to be an MBox file, you could probably avoid this problem by creating a new folder (which will be a Maildir directory) and adjusting POP3 account settings to use it as destination.
Comment 2 Juergen Spitzmueller 2011-06-14 20:37:08 UTC
Maybe the problem is related to filtering. I have several filters that sort POP mails into folders.

It seems to me that the crash happens while the messages are being copied.

As to the setup change: I'd like to avoid that if possible.
Comment 3 Kevin Krammer 2011-06-14 21:47:31 UTC
(In reply to comment #2)
> Maybe the problem is related to filtering. I have several filters that sort POP
> mails into folders.

Could you provide some information about the involved folders? Which one is the MBox? The one which gets the mail from POP at download or the one which is the filter target?

> It seems to me that the crash happens while the messages are being copied.

The crash happens when moving message data in the mbox file due to compacting it after some message(s) got deleted.

So my guess is that is the folder which the mail got downloaded to orginally before it gets moved (i.e. the POP3 inbox).

> As to the setup change: I'd like to avoid that if possible.

Sure, I just wanted to be sure you know the options.

Depending on your setup, if the POP3 target folder is really the mbox in this crash, I would actually recommend to make that a maildir.

MBox is by its single file nature very bad for deleting messages. The program working with the mbox (in this case the resource) needs to remember the deletion somewhere else and at some point create a new mbox file with all messages but the delete ones.

In the worst case (first message being deleted) this requires the whole mbox file to be processed.
Comment 4 Juergen Spitzmueller 2011-06-15 08:46:41 UTC
(In reply to comment #3)
> Could you provide some information about the involved folders? Which one is the
> MBox? The one which gets the mail from POP at download or the one which is the
> filter target?

Actually, everything happens inside a "KMail Maildir" resource. The POP3 accounts download to the inbox of this resource, and then the filters shuffle (some of) them into subfolders, which are also inside this resource.
Comment 5 Kevin Krammer 2011-06-15 09:04:47 UTC
"KMail Folders" is a special handler for KMail's potentially mixed mail tree, i.e. supporting folders in either maildir or mbox format.

The backtrace indicates that there was a problem when dealing with one of the mbox folders. This folder has either been created as mbox by choice (KMail allowed to choose the format when creating a new folder) or very old (mbox used to be the default format way back in the old days).

If your POP3 inbox folder is a top level folder under "KMail folders" you can find either a file or a directory with its name in the KMail mail path (e.g. .kde/share/apps/kmail/mail or $HOME/Mail, etc)

If it is a file, the type is mbox, a directory means maildir
Comment 6 Juergen Spitzmueller 2011-06-15 09:29:00 UTC
Oh, I see. Now everything seems to be mbox here then. Both for the source inbox and the target folder I have mbox files in my ~/Mail dir.

This is probably due to "the old days". I'm a long time user, as it were.

I'm currently in the process of shifting everything to the "Local Folders" resource. Let's see if this solves the crashes.
Comment 7 Kevin Krammer 2011-06-15 09:37:06 UTC
(In reply to comment #6)

> I'm currently in the process of shifting everything to the "Local Folders"
> resource. Let's see if this solves the crashes.

Very likely, this is a totally different implementation due to not having to support mbox subfolders.

Alternatively creating a new subfolder in "KMail Folders" will also result in a maildir folder, so doing that for the POP3 inbox folder should also help (since it is the one getting messages added and removed a lot)
Comment 8 Juergen Spitzmueller 2011-06-15 10:13:38 UTC
It's much more stable now. No crashes so far.

(BTW after some days of playing and tweaking, I have to say that I really like PIM 2. It already solves some of my major annoyances with the old KDE PIM. Thanks for your efforts!)
Comment 9 Juergen Spitzmueller 2011-06-16 13:02:13 UTC
I just noticed that only the headers of my mails were copied subfolders from the "KMail Folders" resources to the "Local Folders" resource.

What do I need to do to copy over the whole mail?
Comment 10 Juergen Spitzmueller 2011-06-16 13:04:01 UTC
(In reply to comment #9)
> I just noticed that only the headers of my mails were copied subfolders from

delete "subfolders" from this sentence.
Comment 11 Kevin Krammer 2011-06-17 19:17:40 UTC
I am not aware of any special action needed to copy the full messages.

Can you check $HOME/.config/akonadi/akonadiserverrc, section [%General], if value of ExternalPayload is true?
Comment 12 Juergen Spitzmueller 2011-06-18 07:44:34 UTC
(In reply to comment #11)
> Can you check $HOME/.config/akonadi/akonadiserverrc, section [%General], if
> value of ExternalPayload is true?

It's false. Should it be true?
Comment 13 Kevin Krammer 2011-06-18 11:08:19 UTC
Yes, please change it to true and try if this helps when you copy messages.
Comment 14 Juergen Spitzmueller 2011-06-19 18:19:23 UTC
(In reply to comment #13)
> Yes, please change it to true and try if this helps when you copy messages.

It did help!
Comment 15 Christophe Marin 2011-08-28 16:14:18 UTC
*** Bug 280432 has been marked as a duplicate of this bug. ***
Comment 16 Christophe Marin 2011-08-28 16:14:27 UTC
*** Bug 278915 has been marked as a duplicate of this bug. ***
Comment 17 Christophe Marin 2011-10-14 21:59:13 UTC
*** Bug 284029 has been marked as a duplicate of this bug. ***
Comment 18 e.lazarides 2011-10-26 20:31:02 UTC
Created attachment 64912 [details]
New crash information added by DrKonqi

akonadi_mixedmaildir_resource (4.7) on KDE Platform 4.7.2 (4.7.2) using Qt 4.7.4

- What I was doing when the application crashed:

Deleting messages from the inbox.  I will look at the format of the mailboxes.  Am a long-time user with some 13K messages stored up in various folders.

-- Backtrace (Reduced):
#8  0x0015dcb2 in KMBox::MBox::purge (this=0x83dcfd0, deletedEntries=..., movedEntries=0xbff72668) at /usr/include/i386-linux-gnu/bits/string3.h:58
#9  0x08081a66 in MBoxContext::purge (this=0x83dcfc0, movedEntries=...) at ../../../resources/mixedmaildir/mixedmaildirstore.cpp:174
#10 0x0807d915 in MixedMaildirStore::Private::visit (this=0x83c7d78, job=0x84411f0) at ../../../resources/mixedmaildir/mixedmaildirstore.cpp:2186
#11 0x00e129e7 in Akonadi::FileStore::StoreCompactJob::accept (this=0x84411f0, visitor=0x83c7d78) at ../../../../resources/shared/filestore/storecompactjob.cpp:54
#12 0x0806705c in MixedMaildirStore::processJob (this=0x83c6bd8, job=0x84411f0) at ../../../resources/mixedmaildir/mixedmaildirstore.cpp:2277
Comment 19 Christophe Marin 2011-11-17 23:52:41 UTC
*** Bug 285110 has been marked as a duplicate of this bug. ***
Comment 20 Denis Kurz 2016-09-24 20:45:35 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 21 Denis Kurz 2017-01-07 22:22:37 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.