Bug 463083 - Crash when switching emails
Summary: Crash when switching emails
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: general (show other bugs)
Version: 5.22.0
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-15 20:37 UTC by Albert Astals Cid
Modified: 2023-09-27 21:13 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
gdb thread apply all bt (with debug symbols) (71.97 KB, text/plain)
2023-01-02 16:24 UTC, Sebastian Schrader
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Astals Cid 2022-12-15 20:37:57 UTC
Not super reproduceable but has crashed once per day the last few days.

https://pst.klgrth.io/paste/4ckg3

There's a million threads in the backtrace, not sure if it's crashing on thread 1 (intel drivers urg)  or in thread 13 (kmime)

Hmmm, i'm actually going to vote for kmime beacuse i also have this backtrace https://pst.klgrth.io/paste/4txbf where the crash would seem to be either webengine (thread 1) or kmime (thread 2)
Comment 1 Bug Janitor Service 2022-12-16 00:51:51 UTC
A possibly relevant merge request was started @ https://invent.kde.org/pim/messagelib/-/merge_requests/100
Comment 2 Sebastian Schrader 2023-01-02 16:24:49 UTC
Created attachment 154966 [details]
gdb thread apply all bt (with debug symbols)

I can observe similar message viewer switching related crashes and backtraces. It's easier to reproduce with complex/large messages (probably due to timing). Here's one such backtrace.

OS: Arch Linux (x86_64)
KMail: 5.22.0 (22.12.0)
Comment 3 Bug Janitor Service 2023-05-23 19:41:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/pim/messagelib/-/merge_requests/128
Comment 4 Daniel Vrátil 2023-05-29 12:52:01 UTC
Git commit 624cee41de9780e73951913282eceb376fd34788 by Daniel Vrátil.
Committed on 29/05/2023 at 12:40.
Pushed by dvratil into branch 'release/23.04'.

Fix crash when switching signed/encrypted emails very fast

Kleo::KeyCache internally uses a QEventLoop to block until it
finishes initializing. The initialization happens the first
time the user opens a signed or encrypted email. If they switch
to another email before the KeyCache is done initializing it
leads to a crash in MessageViewer, since message pointers change
while MessageViewer is still "blocked" in OTP.

To avoid the crash, and running a nested event loop in general,
this change introduces KeyCacheMemento, which allows to wait for
the KeyCache to initialize asynchronously before the MessagePart
queries it.

M  +4    -0    mimetreeparser/src/CMakeLists.txt
A  +61   -0    mimetreeparser/src/memento/compositememento.cpp     [License: GPL(v2.0+)]
A  +60   -0    mimetreeparser/src/memento/compositememento.h     [License: GPL(v2.0+)]
A  +50   -0    mimetreeparser/src/memento/keycachememento.cpp     [License: GPL(v2.0+)]
A  +40   -0    mimetreeparser/src/memento/keycachememento.h     [License: GPL(v2.0+)]
M  +55   -16   mimetreeparser/src/messagepart.cpp
M  +9    -1    mimetreeparser/src/messagepart.h

https://invent.kde.org/pim/messagelib/-/commit/624cee41de9780e73951913282eceb376fd34788
Comment 5 Daniel Vrátil 2023-09-27 21:13:29 UTC
Git commit 938fab622b7eb258f89f9b1492a3a264c260be58 by Daniel Vrátil.
Committed on 27/09/2023 at 23:13.
Pushed by dvratil into branch 'release/23.08'.

Fix crash when switching signed/encrypted emails very fast

Kleo::KeyCache internally uses a QEventLoop to block until it
finishes initializing. The initialization happens the first
time the user opens a signed or encrypted email. If they switch
to another email before the KeyCache is done initializing it
leads to a crash in MessageViewer, since message pointers change
while MessageViewer is still "blocked" in OTP.

To avoid the crash, and running a nested event loop in general,
this change introduces KeyCacheMemento, which allows to wait for
the KeyCache to initialize asynchronously before the MessagePart
queries it.

(cherry picked from commit 624cee41de9780e73951913282eceb376fd34788
from 23.04 branch, because I forgot to merge it to master, so it did
not merge it to 23.08)

M  +4    -0    mimetreeparser/src/CMakeLists.txt
A  +61   -0    mimetreeparser/src/memento/compositememento.cpp     [License: GPL(v2.0+)]
A  +60   -0    mimetreeparser/src/memento/compositememento.h     [License: GPL(v2.0+)]
A  +50   -0    mimetreeparser/src/memento/keycachememento.cpp     [License: GPL(v2.0+)]
A  +40   -0    mimetreeparser/src/memento/keycachememento.h     [License: GPL(v2.0+)]
M  +55   -16   mimetreeparser/src/messagepart.cpp
M  +9    -1    mimetreeparser/src/messagepart.h

https://invent.kde.org/pim/messagelib/-/commit/938fab622b7eb258f89f9b1492a3a264c260be58