[intrepid] file descriptor leak

Bug #276918 reported by Chris Jones
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ConsoleKit
Fix Released
Medium
consolekit (Ubuntu)
Fix Released
Undecided
Unassigned
Hardy
Invalid
Undecided
Martin Pitt

Bug Description

Binary package hint: consolekit

On two separate machines I am seeing consolekit leaking file descriptors. The two things it's repeatedly failing to close are:

 * /etc/ConsoleKit/run-session.d
 * /usr/lib/ConsoleKit/run-session.d

Obviously once it has 1024 fds it hits the default ulimit and subsequently fails to carry out any useful functions.

Related branches

Revision history for this message
Chris Jones (cmsj) wrote :

It has been suggested that this might be a dupe of bug #263245 although I have not seen any segfaulting console-kit-daemons, just log entries like:

Oct 1 23:50:02 localhost console-kit-daemon[6527]: WARNING: Unable to open directory /usr/lib/ConsoleKit/run-session.d: Error opening directory '/usr/lib/ConsoleKit/run-session.d': Too many open files
Oct 1 23:50:02 localhost console-kit-daemon[6527]: WARNING: Cannot create file /var/run/ConsoleKit/database~: Too many open files
Oct 1 23:50:02 localhost console-kit-daemon[6527]: WARNING: Cannot unlink /var/run/ConsoleKit/database: No such file or directory

(wrt the final entrythere, that file does exist, I suspect it only thinks it doesn't because it has no spare fd's with which to check, or something)

Revision history for this message
Martin Pitt (pitti) wrote :

I just debugged bug #263245, which was due to a double close(). This might have very well messed up the fd table and cause this, but it's just wild speculation. The fix will go in right after beta release (already uploaded). Can you still reproduce the problem with the new version? Thanks!

Changed in consolekit:
status: New → Incomplete
Revision history for this message
In , Steve Langasek (vorlon) wrote :

Created an attachment (id=19357)
patch to fix fd leak

Chris Jones observed that console-kit-daemon had open a large number of redundant file descriptors, pointing to /etc/ConsoleKit/run-session.d and
/usr/lib/ConsoleKit/run-session.d. It turns out that ck_run_programs() doesn't close the directory handles after iterating, resulting in a fd leak and a small memory leak.

The attached patch corrects this.

Steve Langasek (vorlon)
Changed in consolekit:
status: Incomplete → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package consolekit - 0.2.10-1ubuntu7

---------------
consolekit (0.2.10-1ubuntu7) intrepid; urgency=low

  * debian/patches/09-directory-handle-leak.patch: close the directory
    handle when we're done with it, so that we aren't leaking file
    descriptors. Thanks to Chris Jones for noticing this! LP: #276918.

 -- Steve Langasek <email address hidden> Fri, 03 Oct 2008 19:06:41 +0000

Changed in consolekit:
status: In Progress → Fix Released
Changed in consolekit:
status: Unknown → Confirmed
Revision history for this message
Martin Pitt (pitti) wrote :

While I am preparing the SRU for bug 263245, this can go with it. Trivial and obvious patch.

Changed in consolekit:
assignee: nobody → pitti
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

Ah, I just checked that this does in fact not affect Hardy at all.

Changed in consolekit:
status: In Progress → Invalid
Revision history for this message
In , William Jon McCann (william-jon-mccann) wrote :

Sorry for the long delay. Thanks for the patch! I've committed it to master.

Changed in consolekit:
status: Confirmed → Fix Released
Changed in consolekit:
importance: Unknown → Medium
Changed in consolekit:
importance: Medium → Unknown
Changed in consolekit:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.