Bug 410935 - akonadi _ews_ressource crashes when setting office365 account
Summary: akonadi _ews_ressource crashes when setting office365 account
Status: REPORTED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: EWS Resource (show other bugs)
Version: 5.12.0
Platform: Neon Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-15 13:22 UTC by julien_palmieri
Modified: 2021-10-09 15:09 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
bug report (26.66 KB, text/plain)
2019-08-15 13:22 UTC, julien_palmieri
Details
New crash information added by DrKonqi (28.07 KB, text/plain)
2019-09-17 12:21 UTC, julien_palmieri
Details
New crash information added by DrKonqi (25.53 KB, text/plain)
2020-02-11 11:19 UTC, julien_palmieri
Details
New crash information added by DrKonqi (6.46 KB, text/plain)
2020-09-01 10:01 UTC, michael
Details
New crash information added by DrKonqi (20.32 KB, text/plain)
2020-12-16 09:48 UTC, julien_palmieri
Details
New crash information added by DrKonqi (20.06 KB, text/plain)
2021-07-29 10:56 UTC, julien_palmieri
Details
New crash information added by DrKonqi (22.49 KB, text/plain)
2021-08-06 10:22 UTC, julien_palmieri
Details
New crash information added by DrKonqi (20.23 KB, text/plain)
2021-10-09 15:09 UTC, julien_palmieri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description julien_palmieri 2019-08-15 13:22:29 UTC
Created attachment 122136 [details]
bug report

SUMMARY

everytime i try to set up my company's office365 account using windows exchange server, akonady crashes when all is done, after signing up the company's loggin page. then it is impossible to modify the ews account settings on kmail, akonady crashes everytime it tries to connect to the account.
i don't have this problem with non office365  microsoft email account (like hotmail)

STEPS TO REPRODUCE
1. create a new kmail receiving account - using a microsoft EWS tyte account
2. enter the email, loggin, passwd, and select Oauth2 account.
3. check for server autodiscovery - if mail loggin and passwd are ok, it finds the right server.
4. click OK
5. the company loggin page appears. fill loggin and passwd, and click OK.
6. Then Akonady_ews_ressourses crashes,  and it is impossible to re-open the kmail ews account to modify or complete it (subscriptions; advances,...), and akonady will crash everytime it tries to reconnect to the server with the attached bug report.

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 julien_palmieri 2019-09-17 12:21:15 UTC
Created attachment 122691 [details]
New crash information added by DrKonqi

akonadi_ews_resource (5.12.1) using Qt 5.12.3

- What I was doing when the application crashed:

i just created a kmail EWS account and logged to my office365 email account.
i could access and log to my company web site and then akonady crashed

-- Backtrace (Reduced):
#6  0x00007f8ac15d9c97 in qstrnlen (maxlen=21933, str=0xab5b49e81a50 <error: Cannot access memory at address 0xab5b49e81a50>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:80
#7  QString::fromUtf8 (str=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:581
#8  Akonadi::TagAttribute::deserialize (this=0x55ada4f7b540, data=...) at ./src/core/tagattribute.cpp:154
#9  0x000055ada287eade in EwsTagStore::unserializeTag (this=this@entry=0x55ada4dcce60, data=..., tag=...) at ./resources/ews/tags/ewstagstore.cpp:95
#10 0x000055ada287f0a2 in EwsTagStore::tags (this=0x55ada4dcce60) at ./resources/ews/tags/ewstagstore.cpp:172
Comment 2 julien_palmieri 2020-02-11 11:19:05 UTC
Created attachment 125842 [details]
New crash information added by DrKonqi

akonadi_ews_resource (5.13.2 (19.12.2)) using Qt 5.13.2

- What I was doing when the application crashed:

just set an akonadi_EWS mail account. all seems OK, i even got my work organization page to log onto, what should be the final step to set the account up. But once my work organization information validated, akonadi_EWS crashes, and does crash everytime i restart the app, or try to check out my mails. Also, it seems somethings are working as i can see all my webmail account folders are visible on kmail. visible but all empty.

-- Backtrace (Reduced):
#6  0x00007f09a7132012 in qstrnlen (maxlen=19, str=0x7f0a7002bacf <error: Cannot access memory at address 0x7f0a7002bacf>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:80
#7  QString::fromUtf8 (str=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:581
#8  Akonadi::TagAttribute::deserialize (this=0x55abf0878f30, data=...) at ./src/core/tagattribute.cpp:155
#9  0x000055abeea537ce in EwsTagStore::unserializeTag (this=this@entry=0x55abf06c7180, data=..., tag=...) at ./resources/ews/tags/ewstagstore.cpp:95
#10 0x000055abeea53d92 in EwsTagStore::tags (this=0x55abf06c7180) at ./resources/ews/tags/ewstagstore.cpp:172
Comment 3 michael 2020-09-01 10:01:13 UTC
Created attachment 131341 [details]
New crash information added by DrKonqi

akonadi_ews_resource (5.15.0 (20.08.0)) using Qt 5.15.0

- What I was doing when the application crashed:

KMail autostarts for me. It tries to connect then the office account immediately crashes. 

When I go into the settings of the account, it shows a green man with a tick saying "Ready". However clicking on "Modify" for the account doesn't work anymore. The only time it worked, I tried to test the login. A new window popped up where I suppose I was going to be able to get Office 365's web login page, but it just stayed white, froze and crashed.

-- Backtrace (Reduced):
#4  0x00007f036a93c681 in Akonadi::TagAttribute::deserialize (this=0x5637d6fc5680, data=...) at /usr/include/qt5/QtCore/qbytearray.h:500
#5  0x00005637d67eb528 in EwsTagStore::unserializeTag (this=<optimized out>, tag=..., data=...) at /usr/include/c++/10/bits/atomic_base.h:333
#6  EwsTagStore::tags (this=<optimized out>) at /usr/src/debug/kdepim-runtime-20.08.0-1.2.x86_64/resources/ews/tags/ewstagstore.cpp:172
#7  EwsGlobalTagsReadJob::getFolderRequestFinished (this=0x5637d6fa5930, job=<optimized out>) at /usr/src/debug/kdepim-runtime-20.08.0-1.2.x86_64/resources/ews/tags/ewsglobaltagsreadjob.cpp:87
#8  0x00007f0361b4b116 in QtPrivate::QSlotObjectBase::call (a=0x7ffe7f103e30, r=0x5637d6fa5930, this=0x5637d7063ba0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
Comment 4 julien_palmieri 2020-12-16 09:48:42 UTC
Created attachment 134111 [details]
New crash information added by DrKonqi

akonadi_ews_resource (5.16.0 (20.12.0)) using Qt 5.15.2

- What I was doing when the application crashed:

Set-up an office365 account on kmail using EWS.
akonadi crashes as soon as the account is set.
the mail account sub-directory appear in the directory tree on screen, 
the account says it is ready but it cannot be modified anymore.
If i try to restart it, it crashes again. 
If configured through IMAP, it works, but i have no access to the calendar.

-- Backtrace (Reduced):
#4  QString::fromUtf8 (str=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:497
#5  Akonadi::TagAttribute::deserialize (this=0x5598016f7ea0, data=...) at ./src/core/attributes/tagattribute.cpp:135
#6  0x0000559800b30c7a in EwsTagStore::unserializeTag (this=<optimized out>, data=..., tag=...) at ./resources/ews/tags/ewstagstore.cpp:82
#7  0x0000559800b30f76 in EwsTagStore::tags (this=0x5598015273d0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qhash.h:419
#8  0x0000559800b2cde3 in EwsGlobalTagsReadJob::getFolderRequestFinished (this=0x5598016acc30, job=<optimized out>) at ./resources/ews/tags/ewsglobaltagsreadjob.cpp:74
Comment 5 julien_palmieri 2021-07-29 10:56:20 UTC
Created attachment 140385 [details]
New crash information added by DrKonqi

akonadi_ews_resource (5.17.3 (21.04.3)) using Qt 5.15.3

- What I was doing when the application crashed:

My company told me to move from using imap as they are moving our mails to MFA system next week and i would loose access to my mail.
i already tried to log with Auth2 using akonady EWS, but it crashes every time. i manage to set the account, log on my company page, kmail sees all my mails account folders, but these stay empty, and akonady crashes.

-- Backtrace (Reduced):
#4  QString::fromUtf8 (str=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:497
#5  Akonadi::TagAttribute::deserialize (this=0x55f76bb81650, data=...) at ./src/core/attributes/tagattribute.cpp:131
#6  0x000055f7696a964c in EwsTagStore::unserializeTag (this=<optimized out>, data=..., tag=...) at ./resources/ews/tags/ewstagstore.cpp:82
#7  0x000055f7696aa5a6 in EwsTagStore::tags (this=0x55f76b95bde0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qhash.h:419
#8  0x000055f7696a6e83 in EwsGlobalTagsReadJob::getFolderRequestFinished (this=0x55f76bb5c060, job=<optimized out>) at ./resources/ews/tags/ewsglobaltagsreadjob.cpp:73
Comment 6 julien_palmieri 2021-08-06 10:22:40 UTC
Created attachment 140561 [details]
New crash information added by DrKonqi

akonadi_ews_resource (5.17.3 (21.04.3)) using Qt 5.15.3

- What I was doing when the application crashed:

I've Made a fresh start to akonady to set a EWS exchange account as it crashed everytime i tried, and this time i cannot use the IMAP system, my company does not allow that anymore,  office365 with mobile text check to log to your mail account.

So i tried again, and got the same answer than usual.
- my company log page appears
- i fill it.
- got the text message code
- press OK
- akonady crashes.
- the account folders do appear but are empty
- the account status says ready
- i can't modify the account settings  - have no access to it
- akonady crashes everytime i restart the EWS account and try to update it.
-- it might me something on my company side, but MACOS users seems to get it working, so... i am not sure.

-- Backtrace (Reduced):
#4  0x00007fa2c1fb2fab in qstrnlen (maxlen=22053, str=0x5627348e25b1 <error: Cannot access memory at address 0x5627348e25b1>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:80
#5  QString::fromUtf8 (str=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:715
#6  Akonadi::TagAttribute::deserialize (this=0x5625349185a0, data=...) at ./src/core/attributes/tagattribute.cpp:130
#7  0x00005625324b664c in EwsTagStore::unserializeTag (this=<optimized out>, data=..., tag=...) at ./resources/ews/tags/ewstagstore.cpp:82
#8  0x00005625324b75a6 in EwsTagStore::tags (this=0x5625346e4bd0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qhash.h:419
Comment 7 Krzysztof Nowicki 2021-08-06 13:28:31 UTC
The EWS resource keeps a copy of e-mail tags along with their metadata on the Exchange server. This is done to enable synchronization of multiple Akonadi instances connected to one Exchange mailbox.

This crash looks like for some reason the EWS resource is upset about this tag metadata, that it reads from the server. The crash is actually inside Akonadi itself, which is unable to read the tag metadata from the data stream.

This will be tricky to work around. The best option would be to erase the server-side copy, but this would require some manual EWS request to be issued.

I would really like to understand why is Akonadi crashing here, whether it's due to malformed tag metadata or due to some other problem.

To debug this, it is necessary to enable EWS request dumps. This can be done by editing ~/.config/QtProject/qtlogging.ini and setting the org.kde.pim.ews.client.proto.debug option to true:

  [Rules]
  org.kde.pim.ews.client.proto.debug=true

With that enabled the problem can be reproduced by an attempt to set-up the account again.

Once the crash happens, you should be able to fetch logs from the systemd journal (I assume you're using systemd):

  journalctl --user -b0 /usr/bin/akonadi_ews_resource

In the log output please search for the "9bf757ae-69b5-4d8a-bf1d-2dd0c0871a28" - the UUID used as the property set for Akonadi EWS. Around this UUID the log should contain a bunch of XML text. Please attach it to the bug report. Please note that it will expose all the tags you have in your KMail, so make sure there is no company confidential stuff in there.

The content of the tag metadata should shed some light on why is Akonadi being so upset trying to read it.
Comment 8 julien_palmieri 2021-08-23 12:21:18 UTC
Hi Krzysztof 

Thanks so much for your reply, and sorry for my late reply, i was on annual leave.

I just tried what you said, unfortunately i might need some more help here, i have no ~/.config/QtProject directory.

I probably need to install Kontact in a specific way or install some specific qt things... could you point me what i miss here ?

Many thanks!
Comment 9 julien_palmieri 2021-10-09 15:09:07 UTC
Created attachment 142280 [details]
New crash information added by DrKonqi

akonadi_ews_resource (5.18.2 (21.08.2)) using Qt 5.15.3

Still the same thing.

I hope it would be fixed as Krzysztof Nowicki did some work on it, but it seems to still crash the same way.

- Custom settings of the application:

-- Backtrace (Reduced):
#4  0x00007f8d3399917b in qstrnlen (maxlen=21891, str=0x5584d1c75a51 <error: Cannot access memory at address 0x5584d1c75a51>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:80
#5  QString::fromUtf8 (str=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:715
#6  Akonadi::TagAttribute::deserialize (this=0x5583d1c7cba0, data=...) at ./src/core/attributes/tagattribute.cpp:130
#7  0x00005583cfccf68c in EwsTagStore::unserializeTag (this=<optimized out>, data=..., tag=...) at ./resources/ews/tags/ewstagstore.cpp:82
#8  0x00005583cfcd05e6 in EwsTagStore::tags (this=0x5583d1a439b0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qhash.h:419