Bug 492547

Summary: Akonadi crashes while automatic mail check in KMail
Product: [Frameworks and Libraries] Akonadi Reporter: Stefano Crocco <stefano.crocco>
Component: serverAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: asturm, axel.braun, carl
Priority: NOR Keywords: drkonqi
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 24.08.1
Sentry Crash Report:
Attachments: New crash information added by DrKonqi

Description Stefano Crocco 2024-09-02 13:49:05 UTC
Application: akonadiserver (6.2.0 (24.08.0))

Qt Version: 6.7.2
Frameworks Version: 6.5.0
Operating System: Linux 6.10.7 x86_64
Windowing System: X11
Distribution: "Gentoo Linux"
DrKonqi: 6.1.4 [KCrashBackend]

-- Information about the crash:
I have configured KMail to check mail from several accounts at given intervals (5 and 30 minutes, depending on the accounts). Starting with akonadi-24.08.0, when KMail is doing this, akonadi sometime crashes.

I've configure akonadi to use the postgresql backend, using postgresql 15.8.

Unfortunately, since this happens during automatic mail checks I don't know if there's a specific account which triggers this behavior.

The crash can be reproduced sometimes.

-- Backtrace (Reduced):
#4  std::__detail::_List_node_base::_M_unhook (this=this@entry=0x7f571802baf0) at /var/tmp/portage/sys-devel/gcc-14.2.1_p20240817/work/gcc-14-20240817/libstdc++-v3/src/c++98/list.cc:143
#7  (anonymous namespace)::Cache::query (this=0x7f571800c5e0, queryStatement=...) at /var/tmp/portage/kde-apps/akonadi-24.08.0/work/akonadi-24.08.0/src/server/storage/querycache.cpp:50
#8  Akonadi::Server::QueryCache::query (queryStatement=...) at /var/tmp/portage/kde-apps/akonadi-24.08.0/work/akonadi-24.08.0/src/server/storage/querycache.cpp:97
#9  0x00005605503fc0d3 in Akonadi::Server::QueryBuilder::exec (this=this@entry=0x7f5729ff8740) at /var/tmp/portage/kde-apps/akonadi-24.08.0/work/akonadi-24.08.0/src/server/storage/querybuilder.cpp:515
#10 0x0000560550368db4 in Akonadi::Server::Flag::retrieveByName (store=store@entry=0x7f5718002010, name=...) at /var/tmp/portage/kde-apps/akonadi-24.08.0/work/akonadi-24.08.0_build/src/server/entities.cpp:5822


Reported using DrKonqi
Comment 1 Stefano Crocco 2024-09-02 13:49:06 UTC
Created attachment 173230 [details]
New crash information added by DrKonqi

DrKonqi auto-attaching complete backtrace.
Comment 2 Bug Janitor Service 2024-09-05 13:55:08 UTC
A possibly relevant merge request was started @ https://invent.kde.org/pim/akonadi/-/merge_requests/208
Comment 3 Daniel Vrátil 2024-09-06 09:23:12 UTC
Git commit dc86d700ee726a7645bd66738c201cf2cb8957af by Daniel Vrátil.
Committed on 06/09/2024 at 09:13.
Pushed by dvratil into branch 'release/24.08'.

Fix crash when query is evicted from QueryCache

The eviction code was bugged and caused unrelated entries to be
evicted from m_keys and m_queries. This lead to m_keys holding
an invalid iterator to m_queries, resulting in a crash.
FIXED-IN: 24.08.1

M  +1    -0    autotests/server/CMakeLists.txt
A  +75   -0    autotests/server/querycachetest.cpp     [License: LGPL(v2.0+)]
M  +16   -5    src/server/storage/querycache.cpp
M  +3    -0    src/server/storage/querycache.h

https://invent.kde.org/pim/akonadi/-/commit/dc86d700ee726a7645bd66738c201cf2cb8957af
Comment 4 Daniel Vrátil 2024-09-12 09:42:35 UTC
*** Bug 492607 has been marked as a duplicate of this bug. ***