Bug 358216 - kmail keeps running in the background after quitting the program
Summary: kmail keeps running in the background after quitting the program
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: general (show other bugs)
Version: Git (master)
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-19 16:06 UTC by Raymond Wooninck
Modified: 2016-08-02 07:53 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raymond Wooninck 2016-01-19 16:06:19 UTC
I have noticed that kmail actually keeps running in the background after you try to close the program.  

Selecting "File -> Quit" makes the systray icon disappear, but the kmail process is still active in the background. Even with "Alt-Tab" window switcher, you can not find the kmail window anymore. One would expect that kmail is gone. When you now start a new kmail session, you suddenly get a crash reported from kmail indicating if you want to report a bug or to restart the program. The newly started kmail functions normally. 

This also applies to kontact !!

Reproducible: Always

Steps to Reproduce:
1. Start kmail or kontact.
2. Choose File -> Quit (kmail or kontact will close normally)
3.  Open a konsole and check with ps if kmail or kontact are still there

Actual Results:  
the kmail or kontact process is still active in the background, but can not be reached. Starting now a new kmail or kontact will cause a crash report for the old active process.

Expected Results:  
The kmail or kontact process is normally closed and disappeared. Starting a new session afterwards should not generate a crash.
Comment 1 Daniel Vrátil 2016-01-19 16:29:06 UTC
Could you try to get a backtrace to see what KMail is doing that's preventing it from closing?
Comment 2 Raymond Wooninck 2016-01-19 19:59:01 UTC
(In reply to Daniel Vrátil from comment #1)
> Could you try to get a backtrace to see what KMail is doing that's
> preventing it from closing?

Hi Dan,

Sure. As long as you let me know what exactly you are looking for or how I should get the backtrace :)
Comment 3 Raymond Wooninck 2016-01-20 13:28:17 UTC
Hi Dan, 

As requested, I attached gdb to the running process and then entered "t a a bt" to create the backtrace. The most interesting part would be this:

Thread 1 (Thread 0x7fab6bb5b800 (LWP 3532)):
#0  0x00007fab68b69c1d in poll () from /lib64/libc.so.6
#1  0x00007fab5e6fbe64 in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fab5e6fbf7c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fab696abb0c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#4  0x00007fab69652b23 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#5  0x00007fab6a4671de in KJob::exec() () from /usr/lib64/libKF5CoreAddons.so.5
#6  0x00007fab6b3b9106 in KMKernel::cleanup (this=this@entry=0x7ffc19a85df0)
    at /usr/src/debug/kdepim-15.12.60git.20160120T085743~887bcda/kmail/kmkernel.cpp:1410
#7  0x00000000004042fa in main (argc=1, argv=0x7ffc19a86008)
    at /usr/src/debug/kdepim-15.12.60git.20160120T085743~887bcda/kmail/main.cpp:153

Looking at the source code of kmkernel.cpp (at line 1410) then it seems to try to run jobStatistics->exec()  which somehow doesn't return. 

Hope this helps. Let me know if you need more info
Comment 4 Raymond Wooninck 2016-01-20 13:36:44 UTC
A better one with also the debug info for libKF5CoreAddons. It could be that it is a change in coreaddons.

Thread 1 (Thread 0x7fab6bb5b800 (LWP 3532)):
#0  0x00007fab68b69c1d in poll () from /lib64/libc.so.6
#1  0x00007fab5e6fbe64 in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fab5e6fbf7c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fab696abb0c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#4  0x00007fab69652b23 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#5  0x00007fab6a4671de in KJob::exec (this=this@entry=0x96df70)
    at /usr/src/debug/kcoreaddons-5.19.0git.20160109T125454~e8444d1/src/lib/jobs/kjob.cpp:199
#6  0x00007fab6b3b9106 in KMKernel::cleanup (this=this@entry=0x7ffc19a85df0)
    at /usr/src/debug/kdepim-15.12.60git.20160120T085743~887bcda/kmail/kmkernel.cpp:1410
#7  0x00000000004042fa in main (argc=1, argv=0x7ffc19a86008)
    at /usr/src/debug/kdepim-15.12.60git.20160120T085743~887bcda/kmail/main.cpp:153
Comment 5 Raymond Wooninck 2016-01-22 19:32:39 UTC
In a number of cases, this also causes a 100% cpu utilization of the remaining kmail process. When this happened, I attached gdb to this kmail process and exactly the same backtrace was generated. 

At this moment it would make kmail not really a good candidate for KDE Apps 16.04
Comment 6 Georg Wolfram 2016-03-29 19:49:13 UTC
I can confirm this bug.

Previously kmail also crashed, when it was started while the old process was still running, but this is fixed now (somehow). See also <https://bbs.archlinux.org/viewtopic.php?id=206628>

Looking at the code in question I tried to disable 'empty local trash folder on exit' and it "solved" the problem.

tl;dr:
with 'empty local trash folder on exit' enabled kmail process hangs indefinitely
Comment 7 Jonathan Marten 2016-05-19 12:36:10 UTC
Possible duplicates: bug 363085, bug 361679.
Comment 8 Ian 2016-07-14 11:23:04 UTC
(In reply to Jonathan Marten from comment #7)
> Possible duplicates: bug 363085, bug 361679.

I'd agree with duplicates

kmail 5.2.3 still not loading GUI after a quit with "Empty Wastebin on Exit" set to on
Qt: 5.6.1 
KDE Frameworks: 5.24.0
 KDE Plasma: 5.7.1 
Kernel: 4.6.3-1-default 
"openSUSE Tumbleweed (20160712) (x86_64)"
Comment 9 Laurent Montel 2016-08-02 06:02:05 UTC
Fixed in 5.3.0
Comment 10 Ian 2016-08-02 07:53:55 UTC
thanks