Very high memory consumption by pdftopdf

Bug #790378 reported by Jonas Schwabe
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cups (Ubuntu)
Fix Released
Medium
Unassigned
Natty
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: cups

I just printed out two different PDF files (I will attach one of them) and after a few secounds my computer was running out of memory (2GB) and also started to fill the swap after a few seconds (4GB) wich slowed down my computer a lot, I could only check out what happend using another VT.
Well I already printed a lot PDF files and this never happened, even whole books thought.
Would be nice if someone could try to reproduce this bug by printing the attached file. If it works fine for others I will somehow try to run a debugger or leak detection program but I think this will be quite challenging with 6GB mem consumption.
BTW: After either the kernel killed (did not find any logs about that) the service or it worked out somehow, the pdf was printed well.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: cups 1.4.6-5ubuntu1
ProcVersionSignature: Ubuntu 2.6.38-8.42-generic 2.6.38.2
Uname: Linux 2.6.38-8-generic i686
Architecture: i386
CupsErrorLog:

Date: Mon May 30 22:33:45 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386 (20110427.1)
Lpstat:
 device for EPSON-Epson-Stylus-SX525WD: usb://EPSON/Stylus%20SX525WD
 device for EPSON-Epson-Stylus-SX525WD-Netzwerk: lpd://192.168.0.253:515/PASSTHRU
MachineType: wortmann M7x0S
Papersize: a4
PpdFiles:
 EPSON-Epson-Stylus-SX525WD: Epson Stylus SX525WD Series - epson-inkjet-printer 1.0.0-1lsb3.2 (Seiko Epson Corporation LSB 3.2)
 EPSON-Epson-Stylus-SX525WD-Netzwerk: Epson Stylus SX525WD Series - epson-inkjet-printer 1.0.0-1lsb3.2 (Seiko Epson Corporation LSB 3.2)
ProcEnviron:
 LANGUAGE=de:en
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.38-8-generic root=UUID=18f749dd-4fb2-465d-8163-56efd4d0c839 ro quiet splash nomodeset video=uvesafb:mode_option=1280x768-24,mtrr=3,scroll=ywrap vt.handoff=7
SourcePackage: cups
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 08/01/2009
dmi.bios.vendor: Phoenix Technologies LTD
dmi.bios.version: 6.00
dmi.board.asset.tag: 1234567890
dmi.board.name: M7x0S
dmi.board.vendor: wortmann
dmi.board.version: Bottom
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 1
dmi.chassis.vendor: SiS
dmi.chassis.version: N/A
dmi.modalias: dmi:bvnPhoenixTechnologiesLTD:bvr6.00:bd08/01/2009:svnwortmann:pnM7x0S:pvrRev.A1:rvnwortmann:rnM7x0S:rvrBottom:cvnSiS:ct1:cvrN/A:
dmi.product.name: M7x0S
dmi.product.version: Rev. A1
dmi.sys.vendor: wortmann

Revision history for this message
Jonas Schwabe (jonas-schwabe) wrote :
Revision history for this message
Jonas Schwabe (jonas-schwabe) wrote :
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I have informed the upstream author of the pdftopdf filter to check what is happening.

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

gh1234, please tell us with which application you have printed the file and which option settings you have used. Please post also the PPD file of your print queue, /etc/cups/ppd/EPSON-Epson-Stylus-SX525WD.ppd and/or /etc/cups/ppd/EPSON-Epson-Stylus-SX525WD-Netzwerk.ppd. In addition, follow the instructions in the sections "CUPS error_log" and "Capturing print job data" on https://wiki.ubuntu.com/DebuggingPrintingProblems for a problematic print job.

Changed in cups (Ubuntu):
status: New → Incomplete
importance: Undecided → Medium
Revision history for this message
Jonas Schwabe (jonas-schwabe) wrote :

Well I use evince the standard PDF viewer, attached the PPD file and the error log with debug enabled.
By the way, it seems like this PDF does not print well on Windows too.

Revision history for this message
Jonas Schwabe (jonas-schwabe) wrote :
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

gh1234, thank you for the PPD file. Can you also attach the error_log and the captured print job data which you did not attach yet?

Revision history for this message
Jonas Schwabe (jonas-schwabe) wrote :

The printout file renders well.
/home/jonas/printout: PDF document, version 1.5

I will attach this one too.
I think these are all files.
Thanks for the help!

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

I can simply reproduce the bug by running the command

/usr/lib/cups/filter/pdftopdf 1 1 1 1 "" printout > output

printout is the file attached to comment #8.

"top" in another terminal shows the high memory consumption and system load. I have to stop the command with Ctrl+C to get the system responsive again.

Changed in cups (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Note that printout is still much bigger than the original file:

till@till:~/ghostscript/testfiles$ ls -l vk2010-a2-wtr.pdf
-rw-r--r-- 1 till till 402320 2011-05-30 22:49 vk2010-a2-wtr.pdf
till@till:~/ghostscript/testfiles$ ls -l printout
-rwxr-xr-x 1 till till 17107502 2011-05-31 19:38 printout
till@till:~/ghostscript/testfiles$

So there is still improvement needed on PDF generation by Cairo and evince should also do the printing of PDF files by passing the original file through to CUPS instead of re-rendering it. Nevertheless pdftopdf needs to get improved on handling ineffective blown-up PDF files.

summary: - very high memory consumtion (pdftopdf)
+ Very high memory consumption by pdftopdf
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I got the upstream fix now. The problem is a memory leak and I will apply the fix to CUPS soon.

Changed in cups (Ubuntu):
status: Confirmed → In Progress
Changed in cups (Ubuntu Natty):
status: New → Incomplete
status: Incomplete → Triaged
importance: Undecided → Medium
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Committed the fix to the BZR repository of CUPS at Debian, so the next CUPS packages for Debian unstable and Ubuntu Oneiric will contain the fix.

Changed in cups (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The fixed CUPS package for Natty is now uploaded the -proposed queue. As soon as it gets approved please test the new package. A comment with instructions will be posted here then. A debdiff of the changes is attached.

Changed in cups (Ubuntu Natty):
status: Triaged → Fix Committed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

A new fixed CUPS package for Natty is now uploaded the -proposed queue. As soon as it gets approved please test the new package. A comment with instructions will be posted here then. A debdiff of the changes is attached.

The new CUPS package does not fix only this bug, but in total five bugs (therefore the somewhat bigger debdiff): bug 711779, bug 782309, bug 790378, bug 792309, bug 793265. Any help on verifying these fixes is also welcome.

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

Accepted cups into natty-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
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cups - 1.4.6-7

---------------
cups (1.4.6-7) unstable; urgency=low

  * debian/patches/cups-avahi.dpatch: Updated Avahi patch so that it does
    not generate too long service names which Avahi does not accept. Printers
    did not get advertized via DNS-SD then. (LP: #793265).
  * debian/patches/cups-avahi.dpatch: Updated Avahi patch to add the text
    field entry "URF=none" and the service subtype "_universal" so that
    mDNS/Bonjour-advertized printers are recognized by AirPrint clients
    (iPhone/iPad with iOS 4.2 or newer). (LP: #711779).
  * debian/patches/cups-avahi.dpatch: In contrary to the libdns_sd API the
    Avahi API requires port numbers in host order and not in network order.
    This made the Avahi-based DNS-SD broadcasting of CUPS advertizing wronmg
    port numbers. Updated the Avahi patch to fix it. Thanks to Tim Waugh
    from Red Hat on confirming this (LP: #792309).
  * debian/local/filters/pdf-filters/pdftopdf/P2PResources.cxx: Fixed
    memory leak in pdftopdf filter which made the filter taking up several
    gigabytes when processing certain PDF files. Thanks to upstream
    author Koji Otani for the quick fix (LP: #790378).
  * debian/local/pstopdf.convs, debian/local/pstopdf.types: Do not apply
    the PDF printing workflow to PostScript input coming from the Adobe
    Reader. If this PostScript comes from an encrypted (DRM) PDF, it cannot
    be converted to PDF again by Ghostscript (LP: #782309).
 -- Martin Pitt <email address hidden> Tue, 07 Jun 2011 07:04:11 +0200

Changed in cups (Ubuntu):
status: Fix Committed → Fix Released
Changed in cups (Ubuntu):
assignee: nobody → Heru Herdianto (herdiantoheru-yahoo)
Changed in cups (Ubuntu Natty):
assignee: nobody → Heru Herdianto (herdiantoheru-yahoo)
Changed in cups (Ubuntu):
assignee: Heru Herdianto (herdiantoheru-yahoo) → nobody
Changed in cups (Ubuntu Natty):
assignee: Heru Herdianto (herdiantoheru-yahoo) → nobody
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cups - 1.4.6-5ubuntu1.2

---------------
cups (1.4.6-5ubuntu1.2) natty-proposed; urgency=low

  * debian/patches/cups-avahi.dpatch: Updated Avahi patch so that it does
    not generate too long service names which Avahi does not accept. Printers
    did not get advertized via DNS-SD then. (LP: #793265).
  * debian/patches/cups-avahi.dpatch: Updated Avahi patch to add the text
    field entry "URF=none" and the service subtype "_universal" so that
    mDNS/Bonjour-advertized printers are recognized by AirPrint clients
    (iPhone/iPad with iOS 4.2 or newer). (LP: #711779).
  * debian/patches/cups-avahi.dpatch: In contrary to the libdns_sd API the
    Avahi API requires port numbers in host order and not in network order.
    This made the Avahi-based DNS-SD broadcasting of CUPS advertizing wronmg
    port numbers. Updated the Avahi patch to fix it. Thanks to Tim Waugh
    from Red Hat on confirming this (LP: #792309).
  * debian/local/filters/pdf-filters/pdftopdf/P2PResources.cxx: Fixed
    memory leak in pdftopdf filter which made the filter taking up several
    gigabytes when processing certain PDF files. Thanks to upstream
    author Koji Otani for the quick fix (LP: #790378).
  * debian/local/pstopdf.convs, debian/local/pstopdf.types: Do not apply
    the PDF printing workflow to PostScript input coming from the Adobe
    Reader. If this PostScript comes from an encrypted (DRM) PDF, it cannot
    be converted to PDF again by Ghostscript (LP: #782309).
 -- Till Kamppeter <email address hidden> Mon, 5 Jun 2011 13:51:59 +0200

Changed in cups (Ubuntu Natty):
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.