Bug 265400 - Kde is not fully shut down at logout
Summary: Kde is not fully shut down at logout
Status: RESOLVED NOT A BUG
Alias: None
Product: kde
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: Archlinux Packages Linux
: NOR normal with 100 votes (vote)
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
: 265253 267713 268687 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-02-04 13:34 UTC by Anders Lund
Modified: 2013-01-10 09:55 UTC (History)
11 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
kded4_deadlock patch (3.12 KB, patch)
2011-07-20 16:44 UTC, Martin Steigerwald
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Lund 2011-02-04 13:34:50 UTC
Version:           0.4 (using KDE 4.6.0) 
OS:                Linux

Sometimes I notice that KDE becomes very slow, and often the process table shows multiple instances of kded4 in those situations.

So I checked a few times after logout, if kded4 was running, and saw up to tree kde processes. Killing them give a normal, functional KDE session.

Reproducible: Sometimes

Steps to Reproduce:
Hm, it may happen always. I very often goes directly to shutdown. In every test I made today, this problem happened.



OS: Linux (i686) release 2.6.37-ARCH
Compiler: gcc
Comment 1 Christoph Feck 2011-02-04 15:52:49 UTC
It most likely is not a bug in ksmserver, as that has not changed in ages. I suspect the bug is in Solid changes, but unless we have more information, any kded module could prevent the kded4 process from exiting.
Comment 2 Lamarque V. Souza 2011-02-04 15:57:27 UTC
*** Bug 265253 has been marked as a duplicate of this bug. ***
Comment 3 Anders Lund 2011-02-04 16:13:07 UTC
If there is anything I can do to collect information, please let me know :)
Comment 4 Pyroman 2011-02-04 23:48:45 UTC
I have same problem. Sometimes when I logout from KDE, kded4 doesn't finish and loads CPU in background.
Comment 5 Pyroman 2011-02-04 23:52:32 UTC
(In reply to comment #4)
> I have same problem. Sometimes when I logout from KDE, kded4 doesn't finish and
> loads CPU in background.

KDE 4.6.0
Kubuntu 10.10 (Maverick) 32 bit
Comment 6 Christoph Feck 2011-02-06 15:48:03 UTC
Re-add CC members.
Comment 7 Pyroman 2011-03-06 10:53:41 UTC
It's fixed in 4.6.1.
Comment 8 Anders Lund 2011-03-07 00:45:19 UTC
I just tried logging out and back in. Only one kded process, so that is good. but logging in, i was wellcomed by dr konqui, nepomukservicestub had crashed...
Comment 9 Anders Lund 2011-03-07 00:52:24 UTC
Next attempt went better, no crash, so now nepomuk is usable. So maybe this is actually gone :-)
Comment 10 Christoph Feck 2011-03-08 23:11:24 UTC
Regarding Nepomuk, this is probably bug 267666. If unsure, please report a new bug for Nepomuk. It is probably caused by a regression in 4.6.1, or by updates to Virtuoso.

Regarding the kded4 problem (this bug), I assume this was resolved and caused by Solid udisk/fstab issues. If you still have problems, reopen or report a new bug.
Comment 11 Anders Lund 2011-03-08 23:46:30 UTC
Yay! :-)

I can not help thinking that nepomuk reliably crashing on relogin is related. Log out, log in, nepomukservicestub or somthing like that crashes. Log out and in again, and it does not. If I experience it again, I'll file a new issue, with the traceback.
Comment 12 Lamarque V. Souza 2011-03-17 05:57:38 UTC
*** Bug 267713 has been marked as a duplicate of this bug. ***
Comment 13 Lamarque V. Souza 2011-03-17 05:57:52 UTC
*** Bug 268687 has been marked as a duplicate of this bug. ***
Comment 14 Tristan Miller 2011-03-18 13:54:40 UTC
Please reopen this bug, as I am experiencing this problem fairly consistently upon logging out from KDE 4.6.1.  When I log out, a kded4 process starts consuming 99% of the CPU; I have to log in via the text console and kill it with kill -9.  (Often there is also a knotify4 process also eating 99% of the CPU, though this is probably Bug 216130.)

The problem occurred after I upgraded from KDE 4.5.0 to KDE 4.6.0 on openSUSE 11.3.  Please let me know how I can troubleshoot this; I am happy to send diagnostics, backtraces, etc. if someone tells me how to gather them.
Comment 15 Pyroman 2011-03-18 20:09:59 UTC
I don't experience this problem anymore, but found similar problem. Here is how to reproduce:
launch any KDE program as root with kdesudo, for example kdesudo kate.
This creates a kded4 process which runs with root privileges and this process does not exit after kate is closed.

KDE 4.6.1, Qt 4.7.0, Kubuntu 10.10 (Maverick) 32 bit.
Comment 16 Pyroman 2011-03-18 23:10:20 UTC
(In reply to comment #14)
>Please let me know how I can troubleshoot this;

For a temporary workaround You can use ~/.kde/shutdown/kded4.sh script with this command:
#!/bin/sh
killall -9 kded4

It will be executed on logout from KDE.
Comment 17 Martin Steigerwald 2011-07-13 11:46:46 UTC
What is the current status on this bug?

I reported this as

http://bugs.debian.org/621358

some time ago.

The bug does still happen with KDE SC 4.6.4.


This can get quite heavy on the CPU - aside from hot air its still almost not noticable on my ThinkPad T520, but its not nice on the battery life:

top - 16:02:46 up 21:34, 30 users,  load average: 8.35, 8.25, 8.22
Tasks: 279 total,   2 running, 276 sleeping,   0 stopped,   1 zombie
Cpu(s): 72.7%us, 27.3%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   8083008k total,  3813092k used,  4269916k free,     7660k buffers
Swap: 12582908k total,     8272k used, 12574636k free,  1634300k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                         
27699 martin    20   0  781m  28m  18m S   70  0.4 228:52.67 kded4                                                                           
32129 martin    20   0  779m  28m  18m S   61  0.4 227:47.92 kded4                                                                           
 6511 martin    20   0  777m  28m  18m S   58  0.4 227:46.30 kded4                                                                           
25490 martin    20   0  777m  28m  18m S   52  0.4 228:52.13 kded4                                                                           
 2200 martin    20   0  795m  32m  19m S   50  0.4 227:26.96 kded4                                                                           
26226 martin    20   0  705m  28m  18m S   50  0.4 227:32.63 kded4                                                                           
26961 martin    20   0  761m  28m  18m S   50  0.4 227:07.79 kded4


I once had also two nepomukservices processes running at 100%.
Comment 18 Martin Steigerwald 2011-07-13 11:51:11 UTC
PS: Luca provided a backtrace on the debian bug report that might be useful.
Comment 19 Christoph Feck 2011-07-13 14:38:17 UTC
That's probably bug 269648.
Comment 20 Christoph Feck 2011-07-13 14:40:57 UTC
Please also follow http://kdepepo.wordpress.com/2011/05/11/troubleshooting-kded4-bugs/ to find the offending kded4 module.
Comment 21 Martin Steigerwald 2011-07-17 09:56:07 UTC
Thanks Christoph. Okay, then there are two bugs, cause the issue I experience is unrelated to network filesystems. It happens since 4.6 when I logout and login again the kded4 of the old session is spinning at 99% and only stopable with SIGKILL. This also happens when X crashes.

I will have a look at the blog entry, but maybe I wait until I install KDE 4.7 and test with it, cause when its fixed there, I could spare that time.
Comment 22 Martin Steigerwald 2011-07-20 10:22:39 UTC
Looks like the bug I mentioned is fixed. Dunno whether thats an official upstream patch, doesn´t look like so.

Changes:
 kde4libs (4:4.6.5-2) unstable; urgency=low
 .
   [ José Manuel Santamaría Lema ]
   * Add kded4_deadlock.patch to prevent a deadlock triggered sometimes
     in kded4. (Closes: #621358)

I can extract the patch from the source package in case you are interested.
Comment 23 Christoph Feck 2011-07-20 11:49:03 UTC
Of course we are interested :)
Comment 24 Martin Steigerwald 2011-07-20 16:44:31 UTC
Created attachment 62024 [details]
kded4_deadlock patch

It appears to be an backport of an patch applied upstream for KDE SC 4.7.0.

I had one wild kded4 after applying the patch, but I think that was with the KDE SC 4.6.4 sessions that I didn´t restart yet. I tried with the one of my two sessions that I restarted and logged in and out about three times and there all was well. Well I will have an eye on it. 

Author: Mario Bensi <mbensi@ipsquad.net>
Origin: https://projects.kde.org/projects/kde/kdelibs/repository/revisions/42d40d1d351588a71bef0af1d62a8f6dc586f141
Origin: https://projects.kde.org/projects/kde/kdelibs/repository/revisions/350a5d8de016b6daa36c6e29d5d5f83ad6c2b38d
Applied-Upstream: 4.7.0
Description: This patch is suposed to prevent deadlocks in kded4.
 This patch includes the changes of a couple of upstream commits, these are the
 commit messages:

 ID: 42d40d1d351588a71bef0af1d62a8f6dc586f141
 Fix crash during the QFileSystemWatcher destruction
 The QFileSystemWatcher doesn't work correctly in a singleton
 The solution so far was to destroy the QFileSystemWatcher when the
 application quits but we have some crash with this solution.
 For the moment to workaround the problem, we detach the
 QFileSystemWatcher from the parent effectively leaking it on purpose.

 ID: 350a5d8de016b6daa36c6e29d5d5f83ad6c2b38d
 Fix solid test
 I need to detach parent on QFileSystemWatcher when the FstabWatcher
 destructor are called if the aboutToQuit is not called. It's the case in
 test.

I retrieved it with:

git clone git://git.debian.org/pkg-kde/kde-sc/kde4libs.git
Comment 25 Christoph Feck 2011-09-15 17:27:26 UTC
Sorry for asking again, but what is the status of this bug in KDE 4.7.x?
Comment 26 Anders Lund 2011-09-15 17:51:13 UTC
I still experience this, sometimes logging out of and in to kde is broken, and then there will be > 1 kded4 instance.
Comment 27 Martin Steigerwald 2011-09-15 17:52:32 UTC
I did not see this in

kde4libs (4:4.6.5-2) unstable; urgency=low

  [ José Manuel Santamaría Lema ]
  * Add kded4_deadlock.patch to prevent a deadlock triggered sometimes
    in kded4. (Closes: #621358)

  [ Modestas Vainius ]
  * Confirm symbol files on all arches.

 -- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>  Tue, 19 Jul 2011 23:27:45 +0300

anymore on any of my ThinkPads. I verified that the workaround script in .kde/shutdown that send a SIGKILL to all kded4 instances of the user is no longer present at least on my main ThinkPad T520.

So I consider it fixed when the patch from comment #24 is applied.

The Debian Qt/KDE maintainers do not yet offer 4.7 packages and I am unwilling to compile KDE 4.7 ATM due to much other stuff.
Comment 28 Martin Steigerwald 2011-09-15 18:00:35 UTC
Hmmm, strange. With 4.6.5-2 and the patch it appears to be fixed. But with Anders´ KDE - is that 4.7.0/1? - it doesn´t appear to be fixed. But 4.7.0 should contain the patch. I am puzzled.
Comment 29 Anders Lund 2011-09-15 19:28:32 UTC
I believe my problems are related to nepomuk issues, specificly virtuoso-t going bonkers, at least that have been my reason for trying to renew my session.
Comment 30 Christoph Feck 2013-01-09 23:23:33 UTC
Any remaining processes after logout in KDE 4.9 or KDE 4.10? If yes, please open a new bug report, as this one is quite old and cluttered already.
Comment 31 Tristan Miller 2013-01-10 09:55:00 UTC
I can no longer reproduce the problem on KDE 4.9.5.