system-config-printer keeps tmp files open resulting in the ulimit to be reached

Bug #874445 reported by Bruno Santos
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
system-config-printer (Ubuntu)
Fix Released
Medium
Unassigned
Oneiric
Fix Released
Medium
Unassigned
Precise
Fix Released
Medium
Unassigned

Bug Description

It seems some system-config-printer helper script keeps temporary files open, and eventually reaches the open file limit.

I opened the open files list in system monitor and the list had hundreds of the tmp files generated along with the printer PPD. The tmp files and the PPD are opened more than once.

cups:
  Installed: 1.5.0-8ubuntu1
system-config-printer-gnome:
  Installed: 1.3.6+20110831-0ubuntu9.1

Revision history for this message
Bruno Santos (bsantos) wrote :
Revision history for this message
Bruno Santos (bsantos) wrote :

The same happens with scp-dbus-service.py

description: updated
summary: - system-config-printer.py keeps tmp files open resulting in the ulimit to
- be reached
+ system-config-printer keeps tmp files open resulting in the ulimit to be
+ reached
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tim, can you have a look into this? Thanks.

Revision history for this message
Tim Waugh (twaugh) wrote :

Probably due to the bug fixed in commit a2057a9.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tim, did you push commit a2057a9? I have pulled and the commit does not exist.

Revision history for this message
Tim Waugh (twaugh) wrote :
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Has arrived now, thanks.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The patch is tiny, so I will prepare an SRU for it.

Changed in system-config-printer (Ubuntu):
milestone: none → oneiric-updates
Changed in system-config-printer (Ubuntu Oneiric):
milestone: none → oneiric-updates
Changed in system-config-printer (Ubuntu Precise):
milestone: oneiric-updates → none
Changed in system-config-printer (Ubuntu Oneiric):
status: New → Triaged
Changed in system-config-printer (Ubuntu Precise):
status: New → Triaged
Changed in system-config-printer (Ubuntu Oneiric):
importance: Undecided → Medium
Changed in system-config-printer (Ubuntu Precise):
importance: Undecided → Medium
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Uploaded the fixed system-config-printer package to oneiric-proposed. In some days (after the one-week verification period for bug 872991 ends) this update will get available and announced with another comment please test the update then. A debdiff of the changes is attached.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

For the time being you can already apply the fix manually, by applying the patch from the linked place in comment #6 or from the debdiff in comment #9 to the file /usr/share/system-config-printer/ppdcache.py.

Changed in system-config-printer (Ubuntu Oneiric):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package system-config-printer - 1.3.6+20110831-0ubuntu10

---------------
system-config-printer (1.3.6+20110831-0ubuntu10) precise; urgency=low

  * debian/patches/73_fix_file_descriptor_leak_in_ppdcache.patch: Fixed
    file descriptor leak in PPD cache (LP: #874445).
  * debian/patches/70_use-hpcups-instead-of-ps-with-hp-laserjet-12xx-13xx.patch:
    Use the PCL-5e driver (HPLIP's hpcups) instead of PostScript as recommended
    driver on the HP LaserJet 12xx and 13xx as they do not come with enough
    memory for PostScript. The PostScript driver options are still listed for
    manual selection so that users with a memory extension in the printer can
    use them (LP: #872991).
 -- Till Kamppeter <email address hidden> Fri, 21 Oct 2011 16:06:24 +0200

Changed in system-config-printer (Ubuntu Precise):
status: Triaged → Fix Released
Revision history for this message
Bruno Santos (bsantos) wrote :

The patch fixes the leak, great!

But I still get some left over open fd in system-config-printer.py, are these normal?

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tim, can there be another leak at another place?

Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Hello Bruno, or anyone else affected,

Accepted system-config-printer into oneiric-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Revision history for this message
Bruno Santos (bsantos) wrote : Re: [Bug 874445] Re: system-config-printer keeps tmp files open resulting in the ulimit to be reached

Hi Martin,

The fix solved the major leak, yes, but scp-dbus-service.py seems to
still have some issues, but maybe Tim is already looking into it, and we
can just mark the major issue as fixed.

Regards,
Bruno

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Bruno, thank you for verifying that the fix in the SRU works for you. So I mark the verification of this SRU as done. Depending on further fixes which I get from Tim it is possible that I will provide additional SRUs later.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Tim Waugh (twaugh) wrote :

"Leftover open fd" is a bit vague: does the number of file descriptors go up when repeating a particular action? Which action?

The one I know about is that a file descriptor for a PPD gets left open when viewing properties for a printer. It's a bit tricky to fix, as it's due to a non-trivial reference counting issue somewhere in the UI code. The leaked object is a cups.PPD, I think because of a reference held to it by one of its options, which is referenced by some widget or other.

Revision history for this message
Bruno Santos (bsantos) wrote :

On Qua, 2011-10-26 at 09:53 +0000, Tim Waugh wrote:
> "Leftover open fd" is a bit vague: does the number of file descriptors
> go up when repeating a particular action? Which action?
>
> The one I know about is that a file descriptor for a PPD gets left open
> when viewing properties for a printer. It's a bit tricky to fix, as
> it's due to a non-trivial reference counting issue somewhere in the UI
> code. The leaked object is a cups.PPD, I think because of a reference
> held to it by one of its options, which is referenced by some widget or
> other.

The PPD is one of them, yes, but there are a few open tmp files too. The
fd number doesn't seem to go up with any specific action, though. If I
find an action that alters visibly the number of open fds I'll
reopen/create a bug with more details that can help you find/fix the
bug.

Thanks!

Keep up the good work!

Revision history for this message
Tim Waugh (twaugh) wrote :

Some open temporary files are expected: cups.PPD objects are cached by name, and each cups.PPD object holds a file descriptor for a temporary file containing the PPD, in case it needs to be written out at any stage.

Revision history for this message
Bruno Santos (bsantos) wrote :

On Qua, 2011-10-26 at 14:43 +0000, Tim Waugh wrote:
> Some open temporary files are expected: cups.PPD objects are cached by
> name, and each cups.PPD object holds a file descriptor for a temporary
> file containing the PPD, in case it needs to be written out at any
> stage.

OK, then these must be normal. Thanks for the clarification.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package system-config-printer - 1.3.6+20110831-0ubuntu9.3

---------------
system-config-printer (1.3.6+20110831-0ubuntu9.3) oneiric-proposed; urgency=low

  * debian/patches/73_fix_file_descriptor_leak_in_ppdcache.patch: Fixed
    file descriptor leak in PPD cache (LP: #874445).
 -- Till Kamppeter <email address hidden> Fri, 21 Oct 2011 16:06:24 +0200

Changed in system-config-printer (Ubuntu Oneiric):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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