Application: akonadi_imap_resource (5.12.3) Qt Version: 5.13.2 Frameworks Version: 5.67.0 Operating System: Linux 4.19.97-gentoo+ppp x86_64 Distribution: Gentoo/Linux -- Information about the crash: - What I was doing when the application crashed: The IMAP resource was unresponsive (no ‘ready’ or other status message in akonadiconsole agents list entry; could not update mail in kmail and it didn't react to ‘abort activity’ or ‘restart agent’). It crashed when I tried to take it offline. -- Backtrace: Application: FastMail (akonadi_imap_resource), signal: Segmentation fault Using host libthread_db library "/lib64/libthread_db.so.1". [Current thread is 1 (Thread 0x7f222b7e5300 (LWP 15706))] Thread 10 (Thread 0x7f21ff7fe700 (LWP 19645)): #0 0x00007f223c06aee0 in read () at /lib64/libc.so.6 #1 0x00007f223a511eff in () at /usr/lib64/libglib-2.0.so.0 #2 0x00007f223a4cb26e in g_main_context_check () at /usr/lib64/libglib-2.0.so.0 #3 0x00007f223a4cb6e3 in () at /usr/lib64/libglib-2.0.so.0 #4 0x00007f223a4cb85f in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0 #5 0x00007f223c68e2ab in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7f21ec005b90, flags=...) at kernel/qeventdispatcher_glib.cpp:425 #6 0x00007f223c63947b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7f21ff7fdb60, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:140 #7 0x00007f223c49c381 in QThread::exec() (this=<optimized out>) at ../../include/QtCore/../../src/corelib/global/qflags.h:120 #8 0x00007f223c49d412 in QThreadPrivate::start(void*) (arg=0x56170b048140) at thread/qthread_unix.cpp:360 #9 0x00007f223b6a63a7 in start_thread () at /lib64/libpthread.so.0 #10 0x00007f223c07b24f in clone () at /lib64/libc.so.6 Thread 9 (Thread 0x7f221ce97700 (LWP 16370)): #0 0x00007f223c06f5e3 in poll () at /lib64/libc.so.6 #1 0x00007f223a4cb73e in () at /usr/lib64/libglib-2.0.so.0 #2 0x00007f223a4cb85f in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0 #3 0x00007f223c68e2ab in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7f21f8000b60, flags=...) at kernel/qeventdispatcher_glib.cpp:425 #4 0x00007f223c63947b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7f221ce96b60, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:140 #5 0x00007f223c49c381 in QThread::exec() (this=<optimized out>) at ../../include/QtCore/../../src/corelib/global/qflags.h:120 #6 0x00007f223c49d412 in QThreadPrivate::start(void*) (arg=0x56170b043bb0) at thread/qthread_unix.cpp:360 #7 0x00007f223b6a63a7 in start_thread () at /lib64/libpthread.so.0 #8 0x00007f223c07b24f in clone () at /lib64/libc.so.6 Thread 8 (Thread 0x7f221d94f700 (LWP 16361)): #0 0x00007f223c06aee0 in read () at /lib64/libc.so.6 #1 0x00007f223a511eff in () at /usr/lib64/libglib-2.0.so.0 #2 0x00007f223a4cb26e in g_main_context_check () at /usr/lib64/libglib-2.0.so.0 #3 0x00007f223a4cb6e3 in () at /usr/lib64/libglib-2.0.so.0 #4 0x00007f223a4cb85f in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0 #5 0x00007f223c68e2ab in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7f2204000b60, flags=...) at kernel/qeventdispatcher_glib.cpp:425 #6 0x00007f223c63947b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7f221d94eb60, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:140 #7 0x00007f223c49c381 in QThread::exec() (this=<optimized out>) at ../../include/QtCore/../../src/corelib/global/qflags.h:120 #8 0x00007f223c49d412 in QThreadPrivate::start(void*) (arg=0x56170afdcf70) at thread/qthread_unix.cpp:360 #9 0x00007f223b6a63a7 in start_thread () at /lib64/libpthread.so.0 #10 0x00007f223c07b24f in clone () at /lib64/libc.so.6 Thread 7 (Thread 0x7f221eb66700 (LWP 15817)): #0 0x00007f223a516389 in g_mutex_lock () at /usr/lib64/libglib-2.0.so.0 #1 0x00007f223a4cacb3 in g_main_context_prepare () at /usr/lib64/libglib-2.0.so.0 #2 0x00007f223a4cb66b in () at /usr/lib64/libglib-2.0.so.0 #3 0x00007f223a4cb85f in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0 #4 0x00007f223c68e2ab in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7f2200000b60, flags=...) at kernel/qeventdispatcher_glib.cpp:425 #5 0x00007f223c63947b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7f221eb65b60, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:140 #6 0x00007f223c49c381 in QThread::exec() (this=<optimized out>) at ../../include/QtCore/../../src/corelib/global/qflags.h:120 #7 0x00007f223c49d412 in QThreadPrivate::start(void*) (arg=0x56170af8b720) at thread/qthread_unix.cpp:360 #8 0x00007f223b6a63a7 in start_thread () at /lib64/libpthread.so.0 #9 0x00007f223c07b24f in clone () at /lib64/libc.so.6 Thread 6 (Thread 0x7f221f372700 (LWP 15813)): #0 0x00007f223c06aee0 in read () at /lib64/libc.so.6 #1 0x00007f223a511eff in () at /usr/lib64/libglib-2.0.so.0 #2 0x00007f223a4cb26e in g_main_context_check () at /usr/lib64/libglib-2.0.so.0 #3 0x00007f223a4cb6e3 in () at /usr/lib64/libglib-2.0.so.0 #4 0x00007f223a4cb85f in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0 #5 0x00007f223c68e2ab in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7f220c000b60, flags=...) at kernel/qeventdispatcher_glib.cpp:425 #6 0x00007f223c63947b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7f221f371b30, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:140 #7 0x00007f223c49c381 in QThread::exec() (this=<optimized out>) at ../../include/QtCore/../../src/corelib/global/qflags.h:120 #8 0x00007f223d6c94f6 in () at /usr/lib64/libQt5DBus.so.5 #9 0x00007f223c49d412 in QThreadPrivate::start(void*) (arg=0x7f223d74bd80) at thread/qthread_unix.cpp:360 #10 0x00007f223b6a63a7 in start_thread () at /lib64/libpthread.so.0 #11 0x00007f223c07b24f in clone () at /lib64/libc.so.6 Thread 5 (Thread 0x7f2220fa9700 (LWP 15798)): #0 0x00007f223b6ace57 in pthread_cond_wait@@GLIBC_2.3.2 () at /lib64/libpthread.so.0 #1 0x00007f2222db77ab in () at /usr/lib64/dri/i965_dri.so #2 0x00007f2222db73c7 in () at /usr/lib64/dri/i965_dri.so #3 0x00007f223b6a63a7 in start_thread () at /lib64/libpthread.so.0 #4 0x00007f223c07b24f in clone () at /lib64/libc.so.6 Thread 4 (Thread 0x7f22217aa700 (LWP 15797)): #0 0x00007f223b6ace57 in pthread_cond_wait@@GLIBC_2.3.2 () at /lib64/libpthread.so.0 #1 0x00007f2222db77ab in () at /usr/lib64/dri/i965_dri.so #2 0x00007f2222db73c7 in () at /usr/lib64/dri/i965_dri.so #3 0x00007f223b6a63a7 in start_thread () at /lib64/libpthread.so.0 #4 0x00007f223c07b24f in clone () at /lib64/libc.so.6 Thread 3 (Thread 0x7f2221fab700 (LWP 15796)): #0 0x00007f223b6ace57 in pthread_cond_wait@@GLIBC_2.3.2 () at /lib64/libpthread.so.0 #1 0x00007f2222db77ab in () at /usr/lib64/dri/i965_dri.so #2 0x00007f2222db73c7 in () at /usr/lib64/dri/i965_dri.so #3 0x00007f223b6a63a7 in start_thread () at /lib64/libpthread.so.0 #4 0x00007f223c07b24f in clone () at /lib64/libc.so.6 Thread 2 (Thread 0x7f22227ac700 (LWP 15795)): #0 0x00007f223b6ace57 in pthread_cond_wait@@GLIBC_2.3.2 () at /lib64/libpthread.so.0 #1 0x00007f2222db77ab in () at /usr/lib64/dri/i965_dri.so #2 0x00007f2222db73c7 in () at /usr/lib64/dri/i965_dri.so #3 0x00007f223b6a63a7 in start_thread () at /lib64/libpthread.so.0 #4 0x00007f223c07b24f in clone () at /lib64/libc.so.6 Thread 1 (Thread 0x7f222b7e5300 (LWP 15706)): [KCrash Handler] #6 0x00007f223c5ce919 in qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > >(QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > const&) (ptr=...) at io/qsettings.cpp:3275 #7 QSettings::d_func() (this=<optimized out>) at io/qsettings.h:72 #8 QSettings::setValue(QString const&, QVariant const&) (this=this@entry=0x0, key=..., value=...) at io/qsettings.cpp:3276 #9 0x00007f223dfe981e in Akonadi::AgentBase::setOnline(bool) (this=0x7ffdf6f9a0a0, state=false) at /var/tmp/portage/kde-apps/akonadi-19.08.3/work/akonadi-19.08.3/src/agentbase/agentbase.cpp:1031 #10 0x00007f223e014a95 in Akonadi__StatusAdaptor::setOnline(bool) (state=<optimized out>, this=0x56170af94cd0) at /usr/include/qt5/QtCore/qobject.h:412 #11 Akonadi__StatusAdaptor::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=_o@entry=0x56170af94cd0, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=8, _a=_a@entry=0x7ffdf6f99850) at src/agentbase/statusadaptor.moc:154 #12 0x00007f223e014eb3 in Akonadi__StatusAdaptor::qt_metacall(QMetaObject::Call, int, void**) (this=0x56170af94cd0, _c=QMetaObject::InvokeMetaMethod, _id=8, _a=0x7ffdf6f99850) at src/agentbase/statusadaptor.moc:238 #13 0x00007f223d6d577b in () at /usr/lib64/libQt5DBus.so.5 #14 0x00007f223d6dad01 in () at /usr/lib64/libQt5DBus.so.5 #15 0x00007f223d6db3f7 in () at /usr/lib64/libQt5DBus.so.5 #16 0x00007f223d6de02e in () at /usr/lib64/libQt5DBus.so.5 #17 0x00007f223c664c6a in QObject::event(QEvent*) (this=0x7ffdf6f9a0a0, e=<optimized out>) at kernel/qobject.cpp:1260 #18 0x00007f223d134cc2 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=this@entry=0x56170aab28c0, receiver=receiver@entry=0x7ffdf6f9a0a0, e=e@entry=0x56170b072f60) at kernel/qapplication.cpp:3703 #19 0x00007f223d13e208 in QApplication::notify(QObject*, QEvent*) (this=0x7ffdf6f9a090, receiver=0x7ffdf6f9a0a0, e=0x56170b072f60) at kernel/qapplication.cpp:3449 #20 0x00007f223c63a5ef in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x7ffdf6f9a0a0, event=0x56170b072f60) at kernel/qcoreapplication.cpp:1095 #21 0x00007f223c63d5a3 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x56170aaa8130) at kernel/qcoreapplication.cpp:1840 #22 0x00007f223c68e4f3 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x56170ab0d960) at kernel/qeventdispatcher_glib.cpp:277 #23 0x00007f223a4cb544 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0 #24 0x00007f223a4cb7c8 in () at /usr/lib64/libglib-2.0.so.0 #25 0x00007f223a4cb85f in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0 #26 0x00007f223c68e293 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x56170ab1fdd0, flags=...) at kernel/qeventdispatcher_glib.cpp:423 #27 0x00007f223c63947b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffdf6f99fe0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:140 #28 0x00007f223c641132 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:120 #29 0x00007f223cbb534c in QGuiApplication::exec() () at kernel/qguiapplication.cpp:1788 #30 0x00007f223d134c35 in QApplication::exec() () at kernel/qapplication.cpp:2859 #31 0x00007f223dff8c1e in Akonadi::ResourceBase::init(Akonadi::ResourceBase&) (r=...) at /usr/include/qt5/QtCore/qcoreapplication.h:116 #32 0x000056170a518571 in () #33 0x00007f223bf99f2b in __libc_start_main () at /lib64/libc.so.6 #34 0x000056170a51675a in () [Inferior 1 (process 15706) detached] The reporter indicates this bug may be a duplicate of or related to bug 418595. Possible duplicates by query: bug 418595, bug 414388, bug 411378, bug 411089, bug 400970. Reported using DrKonqi
*** Bug 418595 has been marked as a duplicate of this bug. ***
In this report we get to Akonadi::AgentBase::setOnline via a dbus call and the QSettings member is null, hence the crash; the backtrace from bug 418595 comment0 is a bit different code path, but the end result is the same: Thread 1 (Thread 0x7f83d0b28d80 (LWP 266490)): [KCrash Handler] #6 0x00007f83e3a2d5b9 in qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > >(QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >&) (ptr=...) at io/qsettings.cpp:3277 #7 QSettings::d_func() (this=<optimized out>) at io/qsettings.h:72 #8 QSettings::setValue(QString const&, QVariant const&) (this=this@entry=0x0, key=..., value=...) at io/qsettings.cpp:3278 #9 0x00007f83e561097e in Akonadi::AgentBase::setOnline(bool) (this=0x7ffc21fe7850, state=state@entry=true) at /tmp/portage/kde-apps/akonadi-19.12.3/work/akonadi-19.12.3/src/agentbase/agentbase.cpp:1032 #10 0x0000564e8a389b84 in ImapResourceBase::onConnectDone(int, QString const&) (this=0x7ffc21fe7850, errorCode=<optimized out>, errorString=...) at /tmp/portage/kde-apps/kdepim-runtime-19.12.3/work/kdepim-runtime-19.12.3/resources/imap/imapresourcebase.cpp:290 #11 0x00007f83e3acf585 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffc21fe6e80, r=0x7ffc21fe7850, this=0x564e8a8212b0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:394 #12 doActivate<false>(QObject*, int, void**) (sender=0x564e8a8209e0, signal_index=7, argv=0x7ffc21fe6e80) at kernel/qobject.cpp:3870 #13 0x00007f83e3ac9d47 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=sender@entry=0x564e8a8209e0, m=m@entry=0x564e8a400200 <SessionPool::staticMetaObject>, local_signal_index=local_signal_index@entry=4, argv=argv@entry=0x7ffc21fe6e80) at kernel/qobject.cpp:3930 #14 0x0000564e8a368d26 in SessionPool::connectDone(int, QString const&) (this=this@entry=0x564e8a8209e0, _t1=<optimized out>, _t1@entry=0, _t2=...) at resources/imap/imapresource_autogen/EWIEGA46WW/moc_sessionpool.cpp:302 #15 0x0000564e8a3bb16e in SessionPool::declareSessionReady(KIMAP::Session*) (this=0x564e8a8209e0, session=<optimized out>) at /usr/include/qt5/QtCore/qarraydata.h:257 #16 0x0000564e8a3bc1c4 in SessionPool::onIdDone(KJob*) (this=0x564e8a8209e0, job=<optimized out>) at /tmp/portage/kde-apps/kdepim-runtime-19.12.3/work/kdepim-runtime-19.12.3/resources/imap/sessionpool.cpp:548 #17 0x00007f83e3acf585 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffc21fe7060, r=0x564e8a8209e0, this=0x564e8ad49d10) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:394 #18 doActivate<false>(QObject*, int, void**) (sender=0x7f8364012430, signal_index=6, argv=0x7ffc21fe7060) at kernel/qobject.cpp:3870 #19 0x00007f83e4f55b2c in KJob::result(KJob*, KJob::QPrivateSignal) () at /usr/lib64/libKF5CoreAddons.so.5 #20 0x00007f83e4f5662b in KJob::finishJob(bool) () at /usr/lib64/libKF5CoreAddons.so.5 #21 0x00007f83e57a677c in KIMAP::Job::handleErrorReplies(KIMAP::Response const&) () at /usr/lib64/libKF5IMAP.so.5 #22 0x00007f83e57c5d6b in KIMAP::SessionPrivate::responseReceived(KIMAP::Response const&) () at /usr/lib64/libKF5IMAP.so.5 #23 0x00007f83e3ac7a0c in QObject::event(QEvent*) (this=0x564e8ad5fc60, e=0x7f8364042e80) at kernel/qobject.cpp:1339 #24 0x00007f83e46c2eb3 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=this@entry=0x564e8a59dba0, receiver=receiver@entry=0x564e8ad5fc60, e=e@entry=0x7f8364042e80) at kernel/qapplication.cpp:3684 #25 0x00007f83e46cc3c0 in QApplication::notify(QObject*, QEvent*) (this=0x7ffc21fe7840, receiver=0x564e8ad5fc60, e=0x7f8364042e80) at kernel/qapplication.cpp:3430 #26 0x00007f83e3a9b1ce in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x564e8ad5fc60, event=0x7f8364042e80) at kernel/qcoreapplication.cpp:1092 #27 0x00007f83e3a9ddc7 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x564e8a57b490) at kernel/qcoreapplication.cpp:1832 #28 0x00007f83e3af1ad3 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x564e8a605740) at kernel/qeventdispatcher_glib.cpp:277 #29 0x00007f83e1ba180f in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0 #30 0x00007f83e1ba1bb8 in () at /usr/lib64/libglib-2.0.so.0 #31 0x00007f83e1ba1c4f in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0 #32 0x00007f83e3af1880 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x564e8a613d00, flags=...) at kernel/qeventdispatcher_glib.cpp:423 #33 0x00007f83e3a9a01b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffc21fe7790, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:136 #34 0x00007f83e3aa212f in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:118 #35 0x00007f83e40638ec in QGuiApplication::exec() () at kernel/qguiapplication.cpp:1866 #36 0x00007f83e46c2e25 in QApplication::exec() () at kernel/qapplication.cpp:2824 #37 0x00007f83e562034e in Akonadi::ResourceBase::init(Akonadi::ResourceBase&) (r=...) at /usr/include/qt5/QtCore/qcoreapplication.h:116 #38 0x0000564e8a355351 in Akonadi::ResourceBase::init<ImapResource>(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/include/KF5/AkonadiAgentBase/resourcebase.h:181 #39 0x00007f83e33bce9b in __libc_start_main () at /usr/lib64/libc.so.6 #40 0x0000564e8a352fda in _start () at /tmp/portage/kde-apps/kdepim-runtime-19.12.3/work/kdepim-runtime-19.12.3/resources/imap/main.cpp:22
*** Bug 411089 has been marked as a duplicate of this bug. ***
A possibly relevant merge request was started @ https://invent.kde.org/pim/akonadi/-/merge_requests/24
*** Bug 426090 has been marked as a duplicate of this bug. ***
*** Bug 423557 has been marked as a duplicate of this bug. ***
*** Bug 414404 has been marked as a duplicate of this bug. ***
*** Bug 411378 has been marked as a duplicate of this bug. ***
Git commit 53574eb6fccc8f6a03dcea6c1ca1aa02dd895209 by Ahmad Samir. Committed on 02/09/2020 at 10:20. Pushed by ahmadsamir into branch 'master'. AgentBase: Fix crash in setOnline When setOnline tries to access the mSettings member after the latter has been deleted we get a crash; mSettings is deleted in quit() or cleanup(), therefore it looks like a race condition: the Agent is about to quit, but some other code calls setOnline leading to a crash. It looks like this can happen in more than one way, e.g. via a dbus call (from AgentInstance), or via a sub-class of AgentBase calling setOnline directly. Use a bool member var, modelled after how AgentInstance uses a similar logic. M +8 -0 src/agentbase/agentbase.cpp M +2 -0 src/agentbase/agentbase_p.h https://invent.kde.org/pim/akonadi/commit/53574eb6fccc8f6a03dcea6c1ca1aa02dd895209
(In reply to Ahmad Samir from comment #9) > Git commit 53574eb6fccc8f6a03dcea6c1ca1aa02dd895209 by Ahmad Samir. > Committed on 02/09/2020 at 10:20. > Pushed by ahmadsamir into branch 'master'. > > AgentBase: Fix crash in setOnline Can/will this this be backported to 20.04 and 20.08?
Git commit 66d1135d127331fb3a2a7e047b0577d7e67d3dc2 by Ahmad Samir. Committed on 02/09/2020 at 10:58. Pushed by ahmadsamir into branch 'release/20.08'. AgentBase: Fix crash in setOnline When setOnline tries to access the mSettings member after the latter has been deleted we get a crash; mSettings is deleted in quit() or cleanup(), therefore it looks like a race condition: the Agent is about to quit, but some other code calls setOnline leading to a crash. It looks like this can happen in more than one way, e.g. via a dbus call (from AgentInstance), or via a sub-class of AgentBase calling setOnline directly. Use a bool member var, modelled after how AgentInstance uses a similar logic. (cherry picked from commit 53574eb6fccc8f6a03dcea6c1ca1aa02dd895209) M +8 -0 src/agentbase/agentbase.cpp M +2 -0 src/agentbase/agentbase_p.h https://invent.kde.org/pim/akonadi/commit/66d1135d127331fb3a2a7e047b0577d7e67d3dc2
I asked and I was told that release/20.04 is closed since 20.08 was released. So we don't push commits to the old stable branch. (Of course you can file a bug report in your distro bugzilla and a package maintainer can backport the fix manually, I think it should apply cleanly). Thanks for the reminder about pushing to release/20.08 o/
Still crashes. Application: akonadi_imap_resource (5.15.2 (20.08.2)) Qt Version: 5.15.1 Frameworks Version: 5.75.0 Operating System: Linux 5.8.14-1-default x86_64 Windowing system: X11 Distribution: openSUSE Tumbleweed Thread 1 (Thread 0x7eff3da35080 (LWP 1847)): [KCrash Handler] #4 0x00007eff4e21a8ca in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::operator-> (this=<optimized out>) at io/qsettings.cpp:3270 #5 qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > > (ptr=...) at ../../include/QtCore/../../src/corelib/global/qglobal.h:1135 #6 QSettings::d_func (this=<optimized out>) at io/qsettings.h:72 #7 QSettings::setValue (this=this@entry=0x0, key=..., value=...) at io/qsettings.cpp:3271 #8 0x00007eff4fcc41bd in Akonadi::AgentBase::setOnline (this=0x7ffed6d18a10, state=false) at /usr/include/qt5/QtCore/qstring.h:962
As of today, 2020-12-09, the issue is no longer reproducible on my Fedora 33 system with: * kf5-akonadi-server-20.08.3-1.fc33 * kf5-pimcommon-akonadi-20.08.3-1.fc33
*** Bug 442157 has been marked as a duplicate of this bug. ***
Created attachment 141376 [details] New crash information added by DrKonqi akonadi_imap_resource (5.18.0 (21.08.0)) using Qt 5.15.2 I have all the same issues on akonadi 21.08.0 (Well, I have it for years already, and it happens time to time, I just decided to report it only now). I also redy to bet that it will keep happening on .1 too -- Backtrace (Reduced): #4 0x00007fe085898069 in QSettings::setValue(QString const&, QVariant const&) () at /usr/lib64/libQt5Core.so.5 #5 0x00007fe0872206fd in Akonadi::AgentBase::setOnline(bool) () at /usr/lib64/libKF5AkonadiAgentBase.so.5 #6 0x000055e0b6ff2252 in ImapResourceBase::configure(unsigned long long) () #7 0x00007fe08724af43 in Akonadi__ControlAdaptor::qt_metacall(QMetaObject::Call, int, void**) () at /usr/lib64/libKF5AkonadiAgentBase.so.5 #8 0x00007fe085bdd669 in QDBusConnectionPrivate::deliverCall(QObject*, int, QDBusMessage const&, QVector<int> const&, int) () at /usr/lib64/libQt5DBus.so.5
Created attachment 147620 [details] New crash information added by DrKonqi akonadi_imap_resource (5.18.3 (21.08.3)) using Qt 5.15.2 - What I was doing when the application crashed: Trying to toggle online/offline from unclear online/offline state (empty info in akonadiconsole) -- Backtrace (Reduced): #4 0x00007b0237569399 in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::operator->() const (this=<optimized out>) at ../../include/QtCore/../../../qtbase-f4ac0b55c37f2b594ffbe639db43dac365825c7c/src/corelib/tools/qscopedpointer.h:118 [...] #7 QSettings::setValue(QString const&, QVariant const&) (this=this@entry=0x0, key=..., value=...) at /var/tmp/portage/dev-qt/qtcore-5.15.2-r14/work/qtbase-f4ac0b55c37f2b594ffbe639db43dac365825c7c/src/corelib/io/qsettings.cpp:3271 #8 0x00007b0238ff955d in Akonadi::AgentBase::setOnline(bool) (this=0x7ffef3c29750, state=false) at /var/tmp/portage/kde-apps/akonadi-21.08.3/work/akonadi-21.08.3/src/agentbase/agentbase.cpp:1003 #9 0x00007b023902598d in Akonadi__StatusAdaptor::setOnline(bool) (state=<optimized out>, this=<optimized out>) at /var/tmp/portage/kde-apps/akonadi-21.08.3/work/akonadi-21.08.3_build/src/agentbase/statusadaptor.cpp:51 #10 0x00007b0239025c43 in Akonadi__StatusAdaptor::qt_metacall(QMetaObject::Call, int, void**) (this=0x5f49ac78b510, _c=QMetaObject::InvokeMetaMethod, _id=8, _a=0x7ffef3c29110) at /var/tmp/portage/kde-apps/akonadi-21.08.3/work/akonadi-21.08.3_build/src/agentbase/statusadaptor.moc:238
Created attachment 151247 [details] New crash information added by DrKonqi akonadi_imap_resource (5.20.3 (22.04.3)) using Qt 5.15.5 - What I was doing when the application crashed: Trying to restart an IMAP instance that had not visible state (empty instead of ‘Ready’ or something like that) -- Backtrace (Reduced): #4 0x00007322192f4c99 in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::operator->() const (this=<optimized out>) at /var/tmp/portage/dev-qt/qtcore-5.15.5-r2/work/qtbase-everywhere-src-5.15.5/include/QtCore/../../src/corelib/tools/qscopedpointer.h:118 [...] #7 QSettings::setValue(QString const&, QVariant const&) (this=this@entry=0x0, key=..., value=...) at /var/tmp/portage/dev-qt/qtcore-5.15.5-r2/work/qtbase-everywhere-src-5.15.5/src/corelib/io/qsettings.cpp:3271 #8 0x000073221ac3f4dd in Akonadi::AgentBase::setOnline(bool) (this=0x7ffc706bf100, state=true) at /var/tmp/portage/kde-apps/akonadi-22.04.3/work/akonadi-22.04.3/src/agentbase/agentbase.cpp:1000 #9 0x00005e0fec677404 in ImapResourceBase::onConnectDone(int, QString const&) (this=0x7ffc706bf100, errorCode=<optimized out>, errorString=<optimized out>) at /var/tmp/portage/kde-apps/kdepim-runtime-22.04.3/work/kdepim-runtime-22.04.3/resources/imap/imapresourcebase.cpp:271 #10 0x0000732219394e86 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffc706be990, r=0x7ffc706bf100, this=0x5e0fed94c350) at /var/tmp/portage/dev-qt/qtcore-5.15.5-r2/work/qtbase-everywhere-src-5.15.5/include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
Created attachment 153106 [details] New crash information added by DrKonqi akonadi_imap_resource (5.21.2 (22.08.2)) using Qt 5.15.6 i was changing settings within kontact settings and it seemed to crash unexpectedly -- Backtrace (Reduced): #4 0x00007fac6dbc671a in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::operator->() const (this=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:118 [...] #7 QSettings::setValue(QString const&, QVariant const&) (this=0x0, key=..., value=...) at io/qsettings.cpp:3271 #8 0x00007fac6f66fb75 in Akonadi::AgentBase::setOnline(bool) () at /lib64/libKF5AkonadiAgentBase.so.5 #9 0x0000560d5d32f34c in ImapResourceBase::onConnectDone(int, QString const&) (this=0x7ffe14ad2860, errorCode=<optimized out>, errorString=<optimized out>) at /usr/src/debug/kdepim-runtime-22.08.2-1.1.x86_64/resources/imap/imapresourcebase.cpp:271 #10 0x00007fac6dc8205d in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffe14ad2070, r=0x7ffe14ad2860, this=0x560d5eac1b30) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398