Bug 18330 - console-kit-daemon leaks sessions and uses 100% CPU
Summary: console-kit-daemon leaks sessions and uses 100% CPU
Status: RESOLVED FIXED
Alias: None
Product: ConsoleKit
Classification: Unclassified
Component: Daemon (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium major
Assignee: william.jon.mccann
QA Contact:
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2008-10-31 15:34 UTC by jwbaker
Modified: 2009-02-11 18:40 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Unref the dbus proxy when finalizing the session (506 bytes, patch)
2009-01-12 08:20 UTC, James Westby
Details | Splinter Review

Description jwbaker 2008-10-31 15:34:03 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.
Comment 1 jwbaker 2008-11-23 11:38:31 UTC
The downstream has developed a fix for this issue at http://launchpadlibrarian.net/19884292/11-unref-dbus-proxy
Comment 2 James Westby 2009-01-12 08:18:18 UTC
Hi,

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.

Thanks,

James
Comment 3 James Westby 2009-01-12 08:20:06 UTC
Created attachment 21900 [details] [review]
Unref the dbus proxy when finalizing the session
Comment 4 James Westby 2009-02-10 06:57:32 UTC
Hi,

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.

Thanks,

James
Comment 5 william.jon.mccann 2009-02-11 18:40:55 UTC
Sorry for the long delay.  Thanks for the patch!  I've applied this to master now.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.