Bug 445364 - Crash When Akonadi is Checking in the Background
Summary: Crash When Akonadi is Checking in the Background
Status: CONFIRMED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: EWS Resource (show other bugs)
Version: 5.18.80
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Krzysztof Nowicki
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2021-11-12 05:59 UTC by Aaron Nixon
Modified: 2023-04-03 10:35 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Nixon 2021-11-12 05:59:34 UTC
Application: akonadi_ews_resource (5.19.40 (22.03.40))
 (Compiled from sources)
Qt Version: 5.15.2
Frameworks Version: 5.88.0
Operating System: Linux 5.15.0-gentoo-x86_64 x86_64
Windowing System: X11
Distribution: "Gentoo Base System release 2.8"
DrKonqi: 5.23.80 [KCrashBackend]

-- Information about the crash:
- What I was doing when the application crashed:
Just browsing the web, this happens after it's been running a while, usually hours after login.

The reporter is unsure if this crash is reproducible.

-- Backtrace:
Application: Omicron (akonadi_ews_resource), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = {<No data fields>}}
[KCrash Handler]
#6  0x000055ad2996c7d0 in QString::QString(QString const&) (other=<optimized out>, this=<optimized out>) at /usr/include/qt5/QtCore/qstring.h:1093
#7  EwsSettingsBase::eventSubscriptionId() const (this=<optimized out>) at /usr/src/debug/kde-apps/kdepim-runtime-9999/kdepim-runtime-9999_build/resources/ews/ewssettingsbase.h:626
#8  EwsSubscriptionManager::start() (this=0x0) at /usr/src/debug/kde-apps/kdepim-runtime-9999/kdepim-runtime-9999/resources/ews/ewssubscriptionmanager.cpp:48
#9  0x000055ad2995da3b in EwsResource::rootFolderFetchFinished(KJob*) (this=<optimized out>, job=<optimized out>) at /usr/include/qt5/QtCore/qscopedpointer.h:116
#10 0x00007f8eadc3d84e in  () at /usr/lib64/libQt5Core.so.5
#11 0x00007f8eb6b52033 in KJob::result(KJob*, KJob::QPrivateSignal) (this=this@entry=0x55ad2d01ed50, _t1=<optimized out>, _t1@entry=0x55ad2d01ed50, _t2=...) at /usr/src/debug/kde-frameworks/kcoreaddons-9999/kcoreaddons-9999_build/src/lib/KF5CoreAddons_autogen/include/moc_kjob.cpp:633
#12 0x00007f8eb6b5352b in KJob::finishJob(bool) (this=0x55ad2d01ed50, emitResult=<optimized out>) at /usr/src/debug/kde-frameworks/kcoreaddons-9999/kcoreaddons-9999/src/lib/jobs/kjob.cpp:98
#13 0x00007f8eadc3d84e in  () at /usr/lib64/libQt5Core.so.5
#14 0x00007f8eb6b52033 in KJob::result(KJob*, KJob::QPrivateSignal) (this=this@entry=0x55ad2cf8b520, _t1=<optimized out>, _t1@entry=0x55ad2cf8b520, _t2=...) at /usr/src/debug/kde-frameworks/kcoreaddons-9999/kcoreaddons-9999_build/src/lib/KF5CoreAddons_autogen/include/moc_kjob.cpp:633
#15 0x00007f8eb6b5352b in KJob::finishJob(bool) (this=0x55ad2cf8b520, emitResult=<optimized out>) at /usr/src/debug/kde-frameworks/kcoreaddons-9999/kcoreaddons-9999/src/lib/jobs/kjob.cpp:98
#16 0x00007f8eadc3d84e in  () at /usr/lib64/libQt5Core.so.5
#17 0x00007f8eb6f6cc06 in KIO::SlaveInterface::dispatch(int, QByteArray const&) (this=0x55ad2b068960, _cmd=<optimized out>, rawdata=...) at /usr/src/debug/kde-frameworks/kio-9999/kio-9999/src/core/slaveinterface.cpp:149
#18 0x00007f8eb6f6b259 in KIO::SlaveInterface::dispatch() (this=0x55ad2b068960) at /usr/src/debug/kde-frameworks/kio-9999/kio-9999/src/core/slaveinterface.cpp:78
#19 0x00007f8eb6f6f91a in KIO::Slave::gotInput() (this=0x55ad2b068960) at /usr/src/debug/kde-frameworks/kio-9999/kio-9999/src/core/slave.cpp:336
#20 0x00007f8eadc3d84e in  () at /usr/lib64/libQt5Core.so.5
#21 0x00007f8eadc358ee in QObject::event(QEvent*) () at /usr/lib64/libQt5Core.so.5
#22 0x00007f8eae7b764f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#23 0x00007f8eadc0a548 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#24 0x00007f8eadc0d9ea in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib64/libQt5Core.so.5
#25 0x00007f8eadc5daf3 in  () at /usr/lib64/libQt5Core.so.5
#26 0x00007f8ea902fc8b in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
#27 0x00007f8ea902ff38 in  () at /usr/lib64/libglib-2.0.so.0
#28 0x00007f8ea902ffef in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#29 0x00007f8eadc5d5aa in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#30 0x00007f8eadc08ff3 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#31 0x00007f8eb6b547ce in KJob::exec() (this=this@entry=0x55ad2d126a10) at /usr/include/qt5/QtCore/qflags.h:121
#32 0x000055ad2996c438 in EwsSubscriptionManager::cancelSubscription() (this=0x55ad2d101000) at /usr/src/debug/kde-apps/kdepim-runtime-9999/kdepim-runtime-9999/resources/ews/ewssubscriptionmanager.cpp:66
#33 0x000055ad2996e087 in EwsSubscriptionManager::~EwsSubscriptionManager() (this=0x55ad2d101000, __in_chrg=<optimized out>) at /usr/src/debug/kde-apps/kdepim-runtime-9999/kdepim-runtime-9999/resources/ews/ewssubscriptionmanager.cpp:42
#34 0x000055ad2996e159 in EwsSubscriptionManager::~EwsSubscriptionManager() (this=0x55ad2d101000, __in_chrg=<optimized out>) at /usr/src/debug/kde-apps/kdepim-runtime-9999/kdepim-runtime-9999/resources/ews/ewssubscriptionmanager.cpp:43
#35 0x00007f8eb7713be1 in Akonadi::AgentBase::setOnlineInternal(bool) (this=0x7ffe155b27d0, state=<optimized out>) at /usr/src/debug/kde-apps/akonadi-9999/akonadi-9999/src/agentbase/agentbase.cpp:1044
#36 0x00007f8eb7714371 in Akonadi::AgentBase::setTemporaryOffline(int) (this=<optimized out>, makeOnlineInSeconds=15) at /usr/src/debug/kde-apps/akonadi-9999/akonadi-9999/src/agentbase/agentbase.cpp:1013
#37 0x00007f8eadc358ee in QObject::event(QEvent*) () at /usr/lib64/libQt5Core.so.5
#38 0x00007f8eae7b764f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#39 0x00007f8eadc0a548 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#40 0x00007f8eadc0d9ea in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib64/libQt5Core.so.5
#41 0x00007f8eadc5daf3 in  () at /usr/lib64/libQt5Core.so.5
#42 0x00007f8ea902fc8b in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
#43 0x00007f8ea902ff38 in  () at /usr/lib64/libglib-2.0.so.0
#44 0x00007f8ea902ffef in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#45 0x00007f8eadc5d5aa in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#46 0x00007f8eadc08ff3 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#47 0x00007f8eb6b547ce in KJob::exec() (this=this@entry=0x55ad2d136590) at /usr/include/qt5/QtCore/qflags.h:121
#48 0x000055ad2996c438 in EwsSubscriptionManager::cancelSubscription() (this=0x55ad2d134230) at /usr/src/debug/kde-apps/kdepim-runtime-9999/kdepim-runtime-9999/resources/ews/ewssubscriptionmanager.cpp:66
#49 0x000055ad2996e087 in EwsSubscriptionManager::~EwsSubscriptionManager() (this=0x55ad2d134230, __in_chrg=<optimized out>) at /usr/src/debug/kde-apps/kdepim-runtime-9999/kdepim-runtime-9999/resources/ews/ewssubscriptionmanager.cpp:42
#50 0x000055ad2996e159 in EwsSubscriptionManager::~EwsSubscriptionManager() (this=0x55ad2d134230, __in_chrg=<optimized out>) at /usr/src/debug/kde-apps/kdepim-runtime-9999/kdepim-runtime-9999/resources/ews/ewssubscriptionmanager.cpp:43
#51 0x00007f8eb7713be1 in Akonadi::AgentBase::setOnlineInternal(bool) (this=0x7ffe155b27d0, state=<optimized out>) at /usr/src/debug/kde-apps/akonadi-9999/akonadi-9999/src/agentbase/agentbase.cpp:1044
#52 0x00007f8eb7714371 in Akonadi::AgentBase::setTemporaryOffline(int) (this=<optimized out>, makeOnlineInSeconds=15) at /usr/src/debug/kde-apps/akonadi-9999/akonadi-9999/src/agentbase/agentbase.cpp:1013
#53 0x00007f8eadc358ee in QObject::event(QEvent*) () at /usr/lib64/libQt5Core.so.5
#54 0x00007f8eae7b764f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#55 0x00007f8eadc0a548 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#56 0x00007f8eadc0d9ea in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib64/libQt5Core.so.5
#57 0x00007f8eadc5daf3 in  () at /usr/lib64/libQt5Core.so.5
#58 0x00007f8ea902fc8b in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
#59 0x00007f8ea902ff38 in  () at /usr/lib64/libglib-2.0.so.0
#60 0x00007f8ea902ffef in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#61 0x00007f8eadc5d5aa in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#62 0x00007f8eadc08ff3 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#63 0x00007f8eb6b547ce in KJob::exec() (this=this@entry=0x55ad2b61db10) at /usr/include/qt5/QtCore/qflags.h:121
#64 0x000055ad2996c438 in EwsSubscriptionManager::cancelSubscription() (this=0x55ad2d065d50) at /usr/src/debug/kde-apps/kdepim-runtime-9999/kdepim-runtime-9999/resources/ews/ewssubscriptionmanager.cpp:66
#65 0x000055ad2996e087 in EwsSubscriptionManager::~EwsSubscriptionManager() (this=0x55ad2d065d50, __in_chrg=<optimized out>) at /usr/src/debug/kde-apps/kdepim-runtime-9999/kdepim-runtime-9999/resources/ews/ewssubscriptionmanager.cpp:42
#66 0x000055ad2996e159 in EwsSubscriptionManager::~EwsSubscriptionManager() (this=0x55ad2d065d50, __in_chrg=<optimized out>) at /usr/src/debug/kde-apps/kdepim-runtime-9999/kdepim-runtime-9999/resources/ews/ewssubscriptionmanager.cpp:43
#67 0x00007f8eb7713be1 in Akonadi::AgentBase::setOnlineInternal(bool) (this=0x7ffe155b27d0, state=<optimized out>) at /usr/src/debug/kde-apps/akonadi-9999/akonadi-9999/src/agentbase/agentbase.cpp:1044
#68 0x00007f8eb7714371 in Akonadi::AgentBase::setTemporaryOffline(int) (this=<optimized out>, makeOnlineInSeconds=15) at /usr/src/debug/kde-apps/akonadi-9999/akonadi-9999/src/agentbase/agentbase.cpp:1013
#69 0x00007f8eadc358ee in QObject::event(QEvent*) () at /usr/lib64/libQt5Core.so.5
#70 0x00007f8eae7b764f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#71 0x00007f8eadc0a548 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#72 0x00007f8eadc0d9ea in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib64/libQt5Core.so.5
#73 0x00007f8eadc5daf3 in  () at /usr/lib64/libQt5Core.so.5
#74 0x00007f8ea902fc8b in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
#75 0x00007f8ea902ff38 in  () at /usr/lib64/libglib-2.0.so.0
#76 0x00007f8ea902ffef in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#77 0x00007f8eadc5d5aa in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#78 0x00007f8eadc08ff3 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#79 0x00007f8eadc11270 in QCoreApplication::exec() () at /usr/lib64/libQt5Core.so.5
#80 0x000055ad299652c2 in Akonadi::ResourceBase::init<EwsResource>(int, char**) (argc=<optimized out>, argv=0x7ffe155b27d0) at /usr/include/KF5/AkonadiAgentBase/akonadi/resourcebase.h:183
#81 0x00007f8ead5bc7fd in __libc_start_main () at /lib64/libc.so.6
#82 0x000055ad29908aca in _start ()
[Inferior 1 (process 2218167) detached]

Reported using DrKonqi
This report was filed against 'kde' because the product 'akonadi_ews_resource' could not be located in Bugzilla. Add it to drkonqi's mappings file!
Comment 1 Krzysztof Nowicki 2023-04-03 10:34:39 UTC
This looks like a race condition when accessing EwsResource::mSubManager pointer. This pointer is set to a newly created EwsSubscriptionManager instance inside EwsResource::rootFolderFetchFinished(), but it looks like after creation the pointer is cleared, which causes the subsequent lines to see a NULL pointer there.

Two functions are able to reset this pointer to NULL: EwsResource::reloadConfig() and EwsResource::doSetOnline(). In theory this should not happen, as all the event processing is done in a single thread, but it looks like one of these functions gets a call from a different thread and the race is on.