I'm using Ubuntu 9.10 (consolekit - 0.3.1-0ubuntu2) and have noticed that this daemon continually sucks up more and more physical memory over time, even when the machine is not being used.

It starts around 3.7MB, but then increases. After about 1-2 days it reaches 200MB, I presume it would continue indefinitely but I usually reboot at that point.

I am also trying to chase down another memory issue that massively impacts performance. The box has 2GB of RAM, but something somewhere seems to be using it, but it isn't accounted for anywhere. free -m indicates that it has been used (ignoring cache and buffers of course!), as does System Monitor. But adding up all the processes' Memory (in S.M.) or all the RES/RSS in ps or top falls many hundreds of MBs short, and this gap increases. Quite quickly it gets to the point where the box is swapping constantly, when the number/type/use of apps shouldn't require anything like it. I do not have any reason to assume this is related, but mention it just in case.

Last night, not long after a reboot and before going to bed: (10MB)
root 891 1.0 0.4 122652 9840 ? Ssl 21:38 0:23 /usr/sbin/console-kit-daemon

I'm running Ubuntu 9.10 x64 with consolekit 0.3.1-0ubuntu2. This workstation has been setting idle fresh from a reboot without logging in for the past two days, and I appear to be suffering from the same issue as this bug report describes.

I am familiar with valgrind, but I haven't dug into how consolekit works. If someone could give me some quick guidance on how to profile consolekit. I'll have 20 or 30 minutes tomorrow evening to try to dig into why this is happening.

This is a really bad bug for my 9.04 (32bit) server. It has 244MB memory and 345MB of swap. Everytime after about a month or 2 my server starts crashing and becomes unavailable from everywhere. A hard reset is the only thing that helps. Turns out it was out of memory and it started killing random daemons. I just found out that console-kit-daemon is using 20% of the available memory. After I killed the console-kit-daemon, *355MB* of memory came free, almost as big as my whole swap. A workaround would be really nice.

Thanks for tracking these down! The review tool doesn't cope very well with having two different patches for the same file apparently so I'm not sure this review will look as intended. Apart from the unref issues I mentioned this looks good.

::: src/ck-manager.c
@@ +1256,1 @@
}

This isn't right. Functions shouldn't generally unref passed in parameters as a side effect.

> This isn't right. Functions shouldn't generally unref passed in parameters as
> a side effect.

I’m pretty sure I needed to do it that way, because ck_session_leader_collect_parameters stashes the callback and the leader away in the pending_jobs queue rather than running the callback immediately. With your modified version of my patch that you committed, is there anything to prevent the leader from being freed while the job is still in the queue?

In the discussion that followed, I was just worried that his modifications introduced a potential use-after-free crash, because the JobData created by ck_session_leader_collect_parameters isn’t holding a reference to its leader. If there is no way for a CkSessionLeader to be freed with entries remaining in its pending_jobs queue (previously this was prevented by the missing unref in create_session_for_sender), then that isn’t a concern and this can be closed. Otherwise, perhaps this presentation makes it clearer why the extra ref and unref are okay?

I started to use Munin to graph the health of my server (9.04). A few days ago I killed console-kit-daemon (which is now a regular task for me), and I just saw these graphs. Apart from the huge memory drop, I also noticed a huge processes drop at the same time I killed this daemon. From 200 to 100 processes! Did killing console-kit-daemon really killed hundred processes?

It's nice it's fixed in Natty, but I'm not using Natty. Can you safely remove this console-kit-daemon? If so, how? By just removing/rename the executable file? I want to trust my server to keep running even when I'm not continuously monitoring it.

Message #22 says: status: Confirmed -> Fix Released
But how to apply the fix to older versions of Ubuntu?
Is it possible to install consolekit (0.4.2-1ubuntu1) natty on those versions?
If so, how?

Also the questions of #20 and #24 remain unanswered.

I have an addition to what I wrote in #20.
I am using Ubuntu 8.04 LTS with Gnome replaced by KDE, on a Thinkpad laptop.
Under my 8.04 the problem seems to disappear when kernel 2.6.31 is used
(basically from Ubuntu 9.10):

William, do you have any comments on this follow-up patch (comment #15)? Or even just a reason that a CkSessionLeader can’t be freed with entries remaining in its pending_jobs queue, and hence the patch wouldn’t be necessary?