Bug 319569

Summary: akonadi_imap_resource crash
Product: [Frameworks and Libraries] Akonadi Reporter: Paul Gideon Dann <pdgiddie+kde>
Component: IMAP resourceAssignee: Christian Mollekopf <chrigi_1>
Status: RESOLVED FIXED    
Severity: crash CC: dvratil, kdepim-bugs, l.mierzwa, mbriza, mollekopf, vkrause
Priority: NOR    
Version: 4.10   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Paul Gideon Dann 2013-05-09 11:55:07 UTC
Random crashes (SIGSEGV) from imap resource.  I think this is actually a stack overflow.  The backtrace is very long, repeating through the same methods again and again.  Here's the bottom:

...
#16204 0x00007ffff4309a95 in KTcpSocket::disconnectFromHost() ()
   from /usr/lib/libkdecore.so.5
#16205 0x00007ffff6001ae8 in ?? () from /usr/lib/libkimap.so.4
#16206 0x00007ffff6003325 in ?? () from /usr/lib/libkimap.so.4
#16207 0x00007ffff73b18ec in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#16208 0x00007ffff430aa11 in KTcpSocket::error(KTcpSocket::Error) ()
   from /usr/lib/libkdecore.so.5
#16209 0x00007ffff430ca13 in ?? () from /usr/lib/libkdecore.so.5
#16210 0x00007ffff73b18ec in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#16211 0x00007ffff62f9db1 in QAbstractSocket::error(QAbstractSocket::SocketError) ()
   from /usr/lib/libQtNetwork.so.4
#16212 0x00007ffff63249bc in ?? () from /usr/lib/libQtNetwork.so.4
#16213 0x00007ffff631f22e in ?? () from /usr/lib/libQtNetwork.so.4
#16214 0x00007ffff631de4d in ?? () from /usr/lib/libQtNetwork.so.4
#16215 0x00007ffff73a5a68 in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericRetur---Type <return> to continue, or q <return> to quit---
nArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const () from /usr/lib/libQtCore.so.4
#16216 0x00007ffff73a7f28 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) () from /usr/lib/libQtCore.so.4
#16217 0x00007ffff62f8ddc in QAbstractSocket::disconnectFromHost() ()
   from /usr/lib/libQtNetwork.so.4
#16218 0x00007ffff4309a95 in KTcpSocket::disconnectFromHost() ()
   from /usr/lib/libkdecore.so.5
#16219 0x00007ffff6001ae8 in ?? () from /usr/lib/libkimap.so.4
#16220 0x00007ffff6003325 in ?? () from /usr/lib/libkimap.so.4
#16221 0x00007ffff73b18ec in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#16222 0x00007ffff430aa11 in KTcpSocket::error(KTcpSocket::Error) ()
   from /usr/lib/libkdecore.so.5
#16223 0x00007ffff430ca13 in ?? () from /usr/lib/libkdecore.so.5
#16224 0x00007ffff73b18ec in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#16225 0x00007ffff62f9db1 in QAbstractSocket::error(QAbstractSocket::SocketError) ()
   from /usr/lib/libQtNetwork.so.4
#16226 0x00007ffff6322f99 in ?? () from /usr/lib/libQtNetwork.so.4
#16227 0x00007ffff63242a5 in ?? () from /usr/lib/libQtNetwork.so.4
#16228 0x00007ffff631ded9 in ?? () from /usr/lib/libQtNetwork.so.4
#16229 0x00007ffff73b18ec in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#16230 0x00007ffff62fef8d in ?? () from /usr/lib/libQtNetwork.so.4
#16231 0x00007ffff6307fdd in ?? () from /usr/lib/libQtNetwork.so.4
#16232 0x00007ffff67430ac in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/libQtGui.so.4
#16233 0x00007ffff6749670 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/libQtGui.so.4
#16234 0x00007ffff48678aa in KApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/libkdeui.so.5
#16235 0x00007ffff739dc3d in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /usr/lib/libQtCore.so.4
#16236 0x00007ffff73cb410 in ?? () from /usr/lib/libQtCore.so.4

#16237 0x00007ffff26bdf06 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#16238 0x00007ffff26be258 in ?? () from /usr/lib/libglib-2.0.so.0
#16239 0x00007ffff26be2fc in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#16240 0x00007ffff73ca8f6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#16241 0x00007ffff739c96f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#16242 0x00007ffff739cc65 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/libQtCore.so.4
#16243 0x00007ffff729b67f in QThread::exec() () from /usr/lib/libQtCore.so.4
#16244 0x00007ffff600179a in ?? () from /usr/lib/libkimap.so.4
#16245 0x00007ffff729dd1f in ?? () from /usr/lib/libQtCore.so.4
#16246 0x00007ffff321fdd2 in start_thread () from /usr/lib/libpthread.so.0
#16247 0x00007ffff3976ced in clone () from /usr/lib/libc.so.6

I know this doesn't look all that useful, but I'm happy to perform any testing that's required.  Also just let me know what binaries you'd like debug symbols installed for to make the backtrace more useful.  Right now, I've had to set up a cron job that checks the resource is still running every minute and re-launches it if not (akonadi generally doesn't notice it's dies, and doesn't re-spawn it).

Reproducible: Sometimes

Steps to Reproduce:
Wait...it crashes every half hour or so.


Expected Results:  
It shouldn't crash.
Comment 1 Martin Bříza 2013-06-04 13:17:11 UTC
This bug is also reported for Fedora 18 on https://bugzilla.redhat.com/show_bug.cgi?id=891620 .
The bug is appearing quite often, according to https://retrace.fedoraproject.org/faf/reports/43249/ it has hundreds of crash reports.
Happens only on x86_64 version of the system.

From what I have seen, it's caused by a SSL handshake error (which doesn't have its error code handled in KTcpSocket... as all the errors added with Qt4.3 and later) which then causes the infinite recursion that can be seen in the backtrace. (There are more readable ones in the linked report than from the original reporter here).
Comment 2 Daniel Vrátil 2013-06-09 14:51:48 UTC
*** Bug 319783 has been marked as a duplicate of this bug. ***
Comment 3 Dawit Alemayehu 2013-06-11 12:35:38 UTC
Git commit ddc33b85e27ab18e84a0183dc35bec3dee3dc597 by Dawit Alemayehu.
Committed on 08/06/2013 at 14:16.
Pushed by adawit into branch 'KDE/4.10'.

Added missing error mapping for SslHandshakeFailedError.
REVIEW: 110894

M  +2    -0    kdecore/network/ktcpsocket.cpp
M  +2    -1    kdecore/network/ktcpsocket.h

http://commits.kde.org/kdelibs/ddc33b85e27ab18e84a0183dc35bec3dee3dc597
Comment 4 Paul Gideon Dann 2013-06-12 12:17:28 UTC
I'm afraid this commit doesn't fix my crash.  I applied it to kdebase, compiled + installed, logged out and back in (for good measure), but the crashes are still occurring, with the same backtrace.
Comment 5 Martin Bříza 2013-06-12 12:21:28 UTC
Yes, it doesn't fix that, it needs handling in the KIMAP library, too. This is basically preparation to do that.
Comment 6 Daniel Vrátil 2013-06-14 19:46:25 UTC
Note that there is a similar bug 316840 which does not crash, but causes an endless loop of connects and disconnects. I can reproduce it on my machine and it's caused by the same SSL issue.
Comment 7 Kevin Ottens 2013-11-16 07:27:26 UTC
The IMAP resource has a new maintainer, reassigning to him.
Comment 8 Christian Mollekopf 2013-11-19 13:12:51 UTC
I'm pretty sure this has been fixed in c3d8ea0 (4.11.3).
If not, please reopen.