Bug 415339

Summary: Akonadi IMAP crashed on waking up from sleep
Product: [Frameworks and Libraries] Akonadi Reporter: Badwi <slamet.badwi>
Component: IMAP resourceAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: dschridde+kde, me, philippe.roubach
Priority: NOR Keywords: drkonqi
Version: 5.13.1   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=418593
https://bugs.kde.org/show_bug.cgi?id=418595
https://bugs.kde.org/show_bug.cgi?id=418912
https://bugs.kde.org/show_bug.cgi?id=396663
https://bugs.kde.org/show_bug.cgi?id=423675
https://bugs.kde.org/show_bug.cgi?id=418599
Latest Commit: Version Fixed In: 5.16.0

Description Badwi 2019-12-19 02:14:32 UTC
Application: akonadi_imap_resource (5.13.0 (19.12.0))
 (Compiled from sources)
Qt Version: 5.12.5
Frameworks Version: 5.65.0
Operating System: Linux 5.3.16-300.fc31.x86_64 x86_64
Distribution: "Fedora release 31 (Thirty One)"

-- Information about the crash:
- What I was doing when the application crashed:
Wake up from sleep state, it showed a DrKonqi notification about the crash.

- Unusual behavior I noticed:
There was another notification about selinux-policy that prevents "tlp" to search for "snapd" (this info may not related though)

- Custom settings of the application:
Kmail was set to Enable system tray icon to be enabled

-- Backtrace:
Application: badwi.my.id (boku) (akonadi_imap_resource), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fc98ce38940 (LWP 1565))]

Thread 7 (Thread 0x7fc95bfff700 (LWP 626426)):
#0  0x00007fc997baaa08 in g_mutex_unlock () at /lib64/libglib-2.0.so.0
#1  0x00007fc997b5dd0d in g_main_context_prepare () at /lib64/libglib-2.0.so.0
#2  0x00007fc997b5e6cb in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0
#3  0x00007fc997b5e8d3 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#4  0x00007fc9999c1da3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#5  0x00007fc99996bcfb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#6  0x00007fc9997c43a5 in QThread::exec() () at /lib64/libQt5Core.so.5
#7  0x00007fc9997c54f6 in QThreadPrivate::start(void*) () at /lib64/libQt5Core.so.5
#8  0x00007fc9989584e2 in start_thread () at /lib64/libpthread.so.0
#9  0x00007fc99942c693 in clone () at /lib64/libc.so.6

Thread 6 (Thread 0x7fc975d29700 (LWP 1693)):
#0  0x00007fc999421a6f in poll () at /lib64/libc.so.6
#1  0x00007fc997b5e79e in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0
#2  0x00007fc997b5e8d3 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#3  0x00007fc9999c1da3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#4  0x00007fc99996bcfb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#5  0x00007fc9997c43a5 in QThread::exec() () at /lib64/libQt5Core.so.5
#6  0x00007fc9997c54f6 in QThreadPrivate::start(void*) () at /lib64/libQt5Core.so.5
#7  0x00007fc9989584e2 in start_thread () at /lib64/libpthread.so.0
#8  0x00007fc99942c693 in clone () at /lib64/libc.so.6

Thread 5 (Thread 0x7fc976f3a700 (LWP 1651)):
#0  0x00007fc99b6adfed in __tls_get_addr_slow () at /lib64/ld-linux-x86-64.so.2
#1  0x00007fc99b6b2fbc in __tls_get_addr () at /lib64/ld-linux-x86-64.so.2
#2  0x00007fc9997c4a9a in QThreadData::current(bool) () at /lib64/libQt5Core.so.5
#3  0x00007fc9999c1c5e in postEventSourcePrepare(_GSource*, int*) () at /lib64/libQt5Core.so.5
#4  0x00007fc997b5dd1a in g_main_context_prepare () at /lib64/libglib-2.0.so.0
#5  0x00007fc997b5e6cb in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0
#6  0x00007fc997b5e8d3 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#7  0x00007fc9999c1da3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#8  0x00007fc99996bcfb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#9  0x00007fc9997c43a5 in QThread::exec() () at /lib64/libQt5Core.so.5
#10 0x00007fc9997c54f6 in QThreadPrivate::start(void*) () at /lib64/libQt5Core.so.5
#11 0x00007fc9989584e2 in start_thread () at /lib64/libpthread.so.0
#12 0x00007fc99942c693 in clone () at /lib64/libc.so.6

Thread 4 (Thread 0x7fc97c923700 (LWP 1648)):
#0  0x00007fc999421a6f in poll () at /lib64/libc.so.6
#1  0x00007fc997b5e79e in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0
#2  0x00007fc997b5e8d3 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#3  0x00007fc9999c1da3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#4  0x00007fc99996bcfb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#5  0x00007fc9997c43a5 in QThread::exec() () at /lib64/libQt5Core.so.5
#6  0x00007fc99aa2cf4a in QDBusConnectionManager::run() () at /lib64/libQt5DBus.so.5
#7  0x00007fc9997c54f6 in QThreadPrivate::start(void*) () at /lib64/libQt5Core.so.5
#8  0x00007fc9989584e2 in start_thread () at /lib64/libpthread.so.0
#9  0x00007fc99942c693 in clone () at /lib64/libc.so.6

Thread 3 (Thread 0x7fc97d4df700 (LWP 1637)):
#0  0x00007fc99895ed45 in pthread_cond_wait@@GLIBC_2.3.2 () at /lib64/libpthread.so.0
#1  0x00007fc97e37014b in util_queue_thread_func () at /usr/lib64/dri/i965_dri.so
#2  0x00007fc97e36fd5b in impl_thrd_routine () at /usr/lib64/dri/i965_dri.so
#3  0x00007fc9989584e2 in start_thread () at /lib64/libpthread.so.0
#4  0x00007fc99942c693 in clone () at /lib64/libc.so.6

Thread 2 (Thread 0x7fc97fb92700 (LWP 1620)):
#0  0x00007fc999421a6f in poll () at /lib64/libc.so.6
#1  0x00007fc99878e38a in _xcb_conn_wait () at /lib64/libxcb.so.1
#2  0x00007fc99878ffea in xcb_wait_for_event () at /lib64/libxcb.so.1
#3  0x00007fc97fd18ac8 in QXcbEventQueue::run() () at /lib64/libQt5XcbQpa.so.5
#4  0x00007fc9997c54f6 in QThreadPrivate::start(void*) () at /lib64/libQt5Core.so.5
#5  0x00007fc9989584e2 in start_thread () at /lib64/libpthread.so.0
#6  0x00007fc99942c693 in clone () at /lib64/libc.so.6

Thread 1 (Thread 0x7fc98ce38940 (LWP 1565)):
[KCrash Handler]
#6  ImapAccount::authenticationMode() const (this=0x0) at /usr/src/debug/kdepim-runtime-19.12.0-1.fc31.x86_64/resources/imap/imapaccount.cpp:85
#7  0x00005578164ac46a in SessionPool::requestPassword() (this=0x557817607a80) at /usr/src/debug/kdepim-runtime-19.12.0-1.fc31.x86_64/resources/imap/sessionpool.cpp:88
#8  0x00005578164b0a45 in SessionPool::processPendingRequests() (this=0x557817607a80) at /usr/src/debug/kdepim-runtime-19.12.0-1.fc31.x86_64/resources/imap/sessionpool.cpp:302
#9  0x00007fc9999a3726 in QSingleShotTimer::timerEvent(QTimerEvent*) () at /lib64/libQt5Core.so.5
#10 0x00007fc999997ce5 in QObject::event(QEvent*) () at /lib64/libQt5Core.so.5
#11 0x00007fc99a491ad6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#12 0x00007fc99a49b150 in QApplication::notify(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#13 0x00007fc99996cdf8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5
#14 0x00007fc9999c1048 in QTimerInfoList::activateTimers() () at /lib64/libQt5Core.so.5
#15 0x00007fc9999c18fc in timerSourceDispatch(_GSource*, int (*)(void*), void*) () at /lib64/libQt5Core.so.5
#16 0x00007fc997b5e4a0 in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#17 0x00007fc997b5e830 in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0
#18 0x00007fc997b5e8d3 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#19 0x00007fc9999c1d85 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#20 0x00007fc99996bcfb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#21 0x00007fc999973a26 in QCoreApplication::exec() () at /lib64/libQt5Core.so.5
#22 0x00007fc99b3ab672 in Akonadi::ResourceBase::init(Akonadi::ResourceBase&) () at /lib64/libKF5AkonadiAgentBase.so.5
#23 0x00005578164488d5 in Akonadi::ResourceBase::init<ImapResource>(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/include/KF5/AkonadiAgentBase/resourcebase.h:181
#24 0x00007fc9993521a3 in __libc_start_main () at /lib64/libc.so.6
#25 0x000055781644695e in _start () at /usr/src/debug/kdepim-runtime-19.12.0-1.fc31.x86_64/resources/imap/main.cpp:22
[Inferior 1 (process 1565) detached]

The reporter indicates this bug may be a duplicate of or related to bug 361101.

Possible duplicates by query: bug 409419, bug 361101, bug 357227, bug 353442, bug 349904.

Reported using DrKonqi
Comment 1 Christophe Marin 2020-01-17 10:00:41 UTC
*** Bug 415930 has been marked as a duplicate of this bug. ***
Comment 2 Christophe Marin 2020-01-17 10:00:49 UTC
*** Bug 415960 has been marked as a duplicate of this bug. ***
Comment 3 Philippe ROUBACH 2020-01-17 10:16:21 UTC
i confirm this.
i was using "captvty".
kontact was minimized in the systray.

2 times : 2020-01-06 and 2020-01-17

kde apps 19.12.1
kde plasma : 5.17.5
kde frameworks : 5.66.0
Qt 5.14.0
kontact 5.13.1
Comment 4 Philippe ROUBACH 2020-01-17 10:17:08 UTC
i forgot : openSuse leap 15.1 Argon.
Comment 5 Christophe Marin 2020-01-17 10:28:17 UTC
Which authentication method is selected in your IMAP accounts settings?
Comment 6 Iyán Méndez Veiga 2020-01-17 10:38:04 UTC
In my case (Bug 415960) I am using the following:

Encryption: STARTTLS
Port: 143
Authentication: PLAIN

Exactly the same configuration as in a different IMAP account which never crashes.
Comment 7 Philippe ROUBACH 2020-01-17 10:39:37 UTC
(In reply to Christophe Giboudeaux from comment #5)
> Which authentication method is selected in your IMAP accounts settings?

imap.free.fr
ssl/tls
993
plain

I have just received "impossible de se connecter au serveur. veuillez vérifier l'adresse du serveur" while I'm on the "advanced" tab.


On the other hand I remember this:

I launch for the first time kmail then this launches the account assistant then this fails because a problem about authentication.
Comment 8 Philippe ROUBACH 2020-01-17 10:40:52 UTC
i forgot.

i manualy created my account with success.
Comment 9 Iyán Méndez Veiga 2020-01-17 12:46:58 UTC
Why Bug 415960  has been marked as a duplicate of this, and Bug 414685 not? I don't think my bug is exactly same as this one (I didn't wake up from sleep state). Sometimes it crashes while using the computer, other times with the screen locked, but I never put computers into a sleep state.
Comment 10 Christophe Marin 2020-01-17 17:00:38 UTC
(In reply to Iyán Méndez Veiga from comment #9)
> Why Bug 415960  has been marked as a duplicate of this, and Bug 414685 not?

Because the backtrace in bug 414685 is lacking debug symbols and could not be found.
Comment 11 Iyán Méndez Veiga 2020-01-17 17:03:30 UTC
> Because the backtrace in bug 414685 is lacking debug symbols and could not
> be found.

What I should do to get them? I compiled kdepim-runtime following these instructions in order to get them:
https://wiki.archlinux.org/index.php/Debug_-_Getting_Traces#CMAKE_(KDE)_applications

In particular, I used -DCMAKE_BUILD_TYPE=RelWithDebInfo. I would like to help as much as possible to get this bug fix.
Comment 12 Ahmad Samir 2020-08-19 18:01:52 UTC
*** Bug 418599 has been marked as a duplicate of this bug. ***
Comment 13 Dennis Schridde 2020-08-20 06:45:35 UTC
(In reply to Ahmad Samir from comment #12)
> *** Bug 418599 has been marked as a duplicate of this bug. ***

I carried over the See-Alsos from bug #418599, which reference issues that appeared on the same systems with the same accounts and might be related to each other.
Comment 14 Bug Janitor Service 2020-08-22 17:39:37 UTC
A possibly relevant merge request was started @ https://invent.kde.org/pim/kdepim-runtime/-/merge_requests/5
Comment 15 Daniel Vrátil 2020-08-24 15:28:28 UTC
Git commit 127cfcc288579b1f268326f623c7652397878b5d by Daniel Vrátil, on behalf of Ahmad Samir.
Committed on 24/08/2020 at 14:45.
Pushed by dvratil into branch 'master'.

Fix crash in SessionPool::requestPassword

If the connection to the imap server is lost, m_account becomes null and
requestPassword would crash trying to access a nullptr. Check m_account in
processPendingRequests and bail out if the connection is lost. Note that a
similar check is used in onPasswordRequestDone.

M  +9    -0    resources/imap/sessionpool.cpp

https://invent.kde.org/pim/kdepim-runtime/commit/127cfcc288579b1f268326f623c7652397878b5d
Comment 16 Iyán Méndez Veiga 2020-08-24 16:54:36 UTC
I applied the patch, and I haven't had any crashes for almost two days. If it continues like these for a few more days, then I guess that was also my problem. One of my accounts was crashing continuously at random times (one or two times per day).

Thank you Ahmad Samir for fixing the issue!
Comment 17 Iyán Méndez Veiga 2020-08-26 11:47:10 UTC
No crashes in three different computers after applying the patch. Solved for me.
Comment 18 Iyán Méndez Veiga 2020-09-05 06:37:34 UTC
Was the patch merged into 20.08.1? After updating with package from repos I got again a crash.
Comment 19 Christoph Feck 2020-09-08 10:46:25 UTC
The fix was applied to master branch, and will be available with the 20.12 releases.