https://bugs.kde.org/show_bug.cgi?id=493635

            Bug ID: 493635
           Summary: EWS resource crashes on "Failed to retrieve
                    authentication data"
    Classification: Frameworks and Libraries
           Product: Akonadi
           Version: 6.2.0
          Platform: Fedora RPMs
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: EWS Resource
          Assignee: kdepim-b...@kde.org
          Reporter: tomastr...@gmx.com
                CC: c...@carlschwan.eu, kri...@op.pl
  Target Milestone: ---

SUMMARY
Since upgrading to kdepim-runtime-24.08.0, the EWS resource crashes after
roughly a hour of working normally with these log messages:

akonadi_ews_resource[488242]: org.kde.pim.ews: Streaming request timeout -
restarting
akonadi_ews_resource[488242]: org.kde.pim.ews.client: Failed to process EWS
request:
audit[488242]: ANOM_ABEND auid=1000 uid=1000 gid=1000 ses=3
subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=488242
comm="akonadi_ews_res" exe="/usr/bin/akonadi_ews_resource" sig=11 res=1
akonadi_ews_resource[488242]: org.kde.pim.ews.client: Failed to retrieve
authentication data

The backtrace looks like this:
#0  0x00007f9fe07eb51e in QObject::deleteLater() () at /lib64/libQt6Core.so.6
#1  0x000055d19523e4a0 in EwsSubscriptionManager::getEventsRequestFinished
(this=0x55d1ca759530, job=0x55d1ca820570)
    at
/usr/src/debug/kdepim-runtime-24.08.0-1.fc40.x86_64/resources/ews/ewssubscriptionmanager.cpp:175
#2  0x00007f9fe07fc8f2 in void doActivate<false>(QObject*, int, void**) () at
/lib64/libQt6Core.so.6
#3  0x00007f9fecc14e16 in KJob::result(KJob*, KJob::QPrivateSignal) () at
/lib64/libKF6CoreAddons.so.6
#4  0x00007f9fecc1724b in KJob::finishJob(bool) () at
/lib64/libKF6CoreAddons.so.6
#5  0x000055d19527dc15 in EwsRequest::prepare (this=0x55d1ca820570, body=...)
at
/usr/src/debug/kdepim-runtime-24.08.0-1.fc40.x86_64/resources/ews/ewsclient/ewsrequest.cpp:73
#6  0x000055d19525e314 in EwsGetStreamingEventsRequest::start
(this=0x55d1ca820570)
    at
/usr/src/debug/kdepim-runtime-24.08.0-1.fc40.x86_64/resources/ews/ewsclient/ewsgetstreamingeventsrequest.cpp:53
#7  0x000055d19523aae1 in EwsSubscriptionManager::getEvents
(this=0x55d1ca759530) at
/usr/src/debug/kdepim-runtime-24.08.0-1.fc40.x86_64/resources/ews/ewssubscriptionmanager.cpp:158
#8  0x00007f9fe07fc8f2 in void doActivate<false>(QObject*, int, void**) () at
/lib64/libQt6Core.so.6
#9  0x00007f9fecc14e16 in KJob::result(KJob*, KJob::QPrivateSignal) () at
/lib64/libKF6CoreAddons.so.6
#10 0x00007f9fecc1724b in KJob::finishJob(bool) () at
/lib64/libKF6CoreAddons.so.6
#11 0x00007f9fe07fc8f2 in void doActivate<false>(QObject*, int, void**) () at
/lib64/libQt6Core.so.6
#12 0x00007f9fecc14e16 in KJob::result(KJob*, KJob::QPrivateSignal) () at
/lib64/libKF6CoreAddons.so.6
#13 0x00007f9fecc1724b in KJob::finishJob(bool) () at
/lib64/libKF6CoreAddons.so.6
#14 0x00007f9fe07fc8f2 in void doActivate<false>(QObject*, int, void**) () at
/lib64/libQt6Core.so.6
#15 0x00007f9fe2138e01 in QNetworkReplyHttpImplPrivate::finished() () at
/lib64/libQt6Network.so.6
#16 0x00007f9fe07eddcb in QObject::event(QEvent*) () at /lib64/libQt6Core.so.6
#17 0x00007f9fe198b218 in QApplicationPrivate::notify_helper(QObject*, QEvent*)
() at /lib64/libQt6Widgets.so.6
#18 0x00007f9fe0796e88 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
() at /lib64/libQt6Core.so.6
#19 0x00007f9fe079ac51 in QCoreApplicationPrivate::sendPostedEvents(QObject*,
int, QThreadData*) () at /lib64/libQt6Core.so.6
#20 0x00007f9fe0a859ef in postEventSourceDispatch(_GSource*, int (*)(void*),
void*) () at /lib64/libQt6Core.so.6
#21 0x00007f9fdf8cee8c in g_main_context_dispatch_unlocked.lto_priv () at
/lib64/libglib-2.0.so.0
#22 0x00007f9fdf930c98 in g_main_context_iterate_unlocked.isra () at
/lib64/libglib-2.0.so.0
#23 0x00007f9fdf8d0383 in g_main_context_iteration () at
/lib64/libglib-2.0.so.0
#24 0x00007f9fe0a851a3 in
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
at /lib64/libQt6Core.so.6
#25 0x00007f9fe07a3bc3 in
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at
/lib64/libQt6Core.so.6
#26 0x00007f9fe079fa7c in QCoreApplication::exec() () at /lib64/libQt6Core.so.6
#27 0x000055d1952372e6 in Akonadi::ResourceBase::init<EwsResource>
(argc=<optimized out>, argv=<optimized out>) at
/usr/include/KPim6/AkonadiAgentBase/akonadi/resourcebase.h:184

The immediate cause is that EwsSubscriptionManager::getEventsRequestFinished()
calls mEventReq->deleteLater(); while on a NULL mEventReq. This is because the
call to EwsSubscriptionManager::getEventsRequestFinished() happens while the
req->start(); call in EwsSubscriptionManager::getEvents() is still underway, so
immediately before mEventReq would be set.

This is because since
https://invent.kde.org/pim/kdepim-runtime/-/commit/b9b4d6c4a433c10694128d9bb5de5e56a75a7bd5,
EwsRequest::prepare() performs emitResult() immediately if getAuthData() fails,
triggering this crash.

I guess maybe just reordering the lines in EwsSubscriptionManager::getEvents()
to set mEventReq before calling start() could be all that's needed to fix this
bug, but I'm not sure if that won't cause the resource into an infinite loop of
failing requests. Can someone more familiar with the code comment on that?

STEPS TO REPRODUCE
1. Set up EWS with oAuth2 against
https://outlook.office365.com/ews/exchange.asmx
2. Wait for an hour or so.

OBSERVED RESULT
Segfault in deleteLater() called from
EwsSubscriptionManager::getEventsRequestFinished().

EXPECTED RESULT
Correctly reported auth failure without the resource segfaulting. (The auth
failure itself is probably a different bug somewhere.)

SOFTWARE/OS VERSIONS
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
Although this sounds vaguely similar to bug 492817, the backtrace there is
completely different, so the two are most likely not duplicates.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to