Bugzilla – Bug 18330
console-kit-daemon leaks sessions and uses 100% CPU
Last modified: 2009-02-11 18:40:55 UTC
console-kit-daemon eventually uses 100% on any system that is up for a sufficiently long time, which can be as short as days. The problem seems to be that console-kit-daemon is leaking sessions, and has some kind of linear or superlinear algorithm for adding or removing a session. This is accompanied by a steady increase in the process size.
I'm using consolekit 0.2.10 from Ubuntu (0.2.10-1ubuntu9, Ubuntu 8.10, x86).
You can easily reproduce this for yourself, as follows:
while `true`; do ssh localhost 'echo $$ && exit'; done;
Assuming you have SSH keys which allow you to login non-interactively. On my system, which as a 3.0GHz dual-core processor, console-kit-daemon started out using less than 1% CPU and less than 2MB of memory, but after ten minutes of this test it's using 19% CPU and has 3.5MB of memory. When I killed it earlier it had used 800 CPU minutes and had 15MB of memory.
Anybody who has a lot of users or cron jobs that fire every minute should be able to see this bug in practice.
The downstream has developed a fix for this issue at http://launchpadlibrarian.net/19884292/11-unref-dbus-proxy
There have now been two separate confirmation that my patch
improves the situation.
Please consider applying it, or let me know what the preferred
fix would be if not.
Created attachment 21900 [details] [review]
Unref the dbus proxy when finalizing the session
This patch is now being shipped in the development release of Ubuntu,
with no reported problems. I am currently preparing an update for Ubuntu
8.10 as there are plenty of users reporting the problem there.
Sorry for the long delay. Thanks for the patch! I've applied this to master now.