Public bug reported:

I have an ipp/AirPrint capable printer (Brother MFC L2710DW) which 
automatically got added by Ubuntu (I'm on XUbuntu).
Printing larger documents will easily use multiple gigabytes of ram. If the 
document is large enough this makes printing impossible or _very_ slow, as the 
process either gets killed or starts swapping.

By watching htop and /proc/$pid/exe I was able to determine that the filter at 
fault seems to be /usr/lib/cups/filter/pdftoraster.
Indeed, manually calling pdftoraster with similar arguments as passed by cups 
(taken from /proc/$pid/cmdline) I can observe the same memory use behaviour.
Memory used seems to be linear in the number of pages and will reach around 7GB 
for a 48 page test-document.

I am not sure if the resolution should be to fix the memory usage of
pdftoraster or to make cups select a different filter chain. I describe
below how I first tried to debug the issue with the help of the Debian
wiki on cupsfilter and wasn't able to get the same behaviour because
cupsfilter would select a different filter chain (involving gstoraster
instead of pdftoraster).

For my current situation it would also be nice to know if there's some
way for me to work around the issue until it's fixed by printing via the
filter chain selected by cupsfilter. Should adding the printer manually
via the xfce interface or the cups webinterface work?

Please let me know if you need more information.

## Further info:

$ lsb_release -rd
Description:    Ubuntu 20.04.2 LTS
Release:        20.04

$ apt-cache policy cups-filters
cups-filters:
  Installed: 1.27.4-1
  Candidate: 1.27.4-1
  Version table:
 *** 1.27.4-1 500
        500 http://at.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status


In the system print settings the printer has the device URI 
"implicitclass://Brother_MFC_L2710DW_series/".
>From watching htop I get the impression that somewhere along the way that 
>changes to "ipp://Brother%20MFC-L2710DW%20series._ipp._tcp.local/" (that's the 
>argv[0] of the offending process, the binary for which is 
>/usr/lib/cups/filter/pdftoraster).

I am attaching test pdfs which exhibit the described memory use when used with 
pdftoraster like this:
/usr/bin/time -v /usr/lib/cups/filter/pdftoraster 99 manu sometitle 1 
'PageSize=A4 output-format=apple-raster Resolution=600dpi' testdoc/test48.pdf > 
pdftorast.out

The memory use and timings I get are in memory_use.txt.
Information about the processes involved and their arguments when printing is 
in watching_printing.txt.


## Trying to debug with cupsfilter:

I also tried to reproduce the issue by following the steps on the debian wiki 
about cupsfilter:
https://wiki.debian.org/CUPSFilter
Interestingly, I could not get cupsfilter to select the same filter chain.
I am not sure which ppd I should be using, though. I tried with 
/etc/cups/ppd/Brother_MFC_L2710DW_series.ppd and with a ppd generated by
driverless cat 'ipp://Brother%20MFC-L2710DW%20series._ipp._tcp.local/'
The former only outputs pdf:

$ /usr/sbin/cupsfilter -p Brother_MFC_L2710DW_series.ppd -m printer/foo -o 
number-up=2 testdoc/test96.pdf -e --list-filters
pdftopdf

The latter uses gstoraster:

$ /usr/sbin/cupsfilter -p driverless.ppd -m printer/foo -o number-up=2 
testdoc/test96.pdf -e --list-filters
pdftopdf
gstoraster
rastertopwg

Running either without the --list-filters option finishes reasonably
fast and doesn't use excessive ram.

** Affects: cups-filters (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "Memory use and timing of pdftoraster"
   
https://bugs.launchpad.net/bugs/1920190/+attachment/5478291/+files/memory_use.txt

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to cups-filters in Ubuntu.
https://bugs.launchpad.net/bugs/1920190

Title:
  When printing to ipp printer, multiple GB of ram are used. pdftoraster
  and/or filter chain selection at fault?

Status in cups-filters package in Ubuntu:
  New

Bug description:
  I have an ipp/AirPrint capable printer (Brother MFC L2710DW) which 
automatically got added by Ubuntu (I'm on XUbuntu).
  Printing larger documents will easily use multiple gigabytes of ram. If the 
document is large enough this makes printing impossible or _very_ slow, as the 
process either gets killed or starts swapping.

  By watching htop and /proc/$pid/exe I was able to determine that the filter 
at fault seems to be /usr/lib/cups/filter/pdftoraster.
  Indeed, manually calling pdftoraster with similar arguments as passed by cups 
(taken from /proc/$pid/cmdline) I can observe the same memory use behaviour.
  Memory used seems to be linear in the number of pages and will reach around 
7GB for a 48 page test-document.

  I am not sure if the resolution should be to fix the memory usage of
  pdftoraster or to make cups select a different filter chain. I
  describe below how I first tried to debug the issue with the help of
  the Debian wiki on cupsfilter and wasn't able to get the same
  behaviour because cupsfilter would select a different filter chain
  (involving gstoraster instead of pdftoraster).

  For my current situation it would also be nice to know if there's some
  way for me to work around the issue until it's fixed by printing via
  the filter chain selected by cupsfilter. Should adding the printer
  manually via the xfce interface or the cups webinterface work?

  Please let me know if you need more information.

  ## Further info:

  $ lsb_release -rd
  Description:  Ubuntu 20.04.2 LTS
  Release:      20.04

  $ apt-cache policy cups-filters
  cups-filters:
    Installed: 1.27.4-1
    Candidate: 1.27.4-1
    Version table:
   *** 1.27.4-1 500
          500 http://at.archive.ubuntu.com/ubuntu focal/main amd64 Packages
          100 /var/lib/dpkg/status

  
  In the system print settings the printer has the device URI 
"implicitclass://Brother_MFC_L2710DW_series/".
  From watching htop I get the impression that somewhere along the way that 
changes to "ipp://Brother%20MFC-L2710DW%20series._ipp._tcp.local/" (that's the 
argv[0] of the offending process, the binary for which is 
/usr/lib/cups/filter/pdftoraster).

  I am attaching test pdfs which exhibit the described memory use when used 
with pdftoraster like this:
  /usr/bin/time -v /usr/lib/cups/filter/pdftoraster 99 manu sometitle 1 
'PageSize=A4 output-format=apple-raster Resolution=600dpi' testdoc/test48.pdf > 
pdftorast.out

  The memory use and timings I get are in memory_use.txt.
  Information about the processes involved and their arguments when printing is 
in watching_printing.txt.

  
  ## Trying to debug with cupsfilter:

  I also tried to reproduce the issue by following the steps on the debian wiki 
about cupsfilter:
  https://wiki.debian.org/CUPSFilter
  Interestingly, I could not get cupsfilter to select the same filter chain.
  I am not sure which ppd I should be using, though. I tried with 
/etc/cups/ppd/Brother_MFC_L2710DW_series.ppd and with a ppd generated by
  driverless cat 'ipp://Brother%20MFC-L2710DW%20series._ipp._tcp.local/'
  The former only outputs pdf:

  $ /usr/sbin/cupsfilter -p Brother_MFC_L2710DW_series.ppd -m printer/foo -o 
number-up=2 testdoc/test96.pdf -e --list-filters
  pdftopdf

  The latter uses gstoraster:

  $ /usr/sbin/cupsfilter -p driverless.ppd -m printer/foo -o number-up=2 
testdoc/test96.pdf -e --list-filters
  pdftopdf
  gstoraster
  rastertopwg

  Running either without the --list-filters option finishes reasonably
  fast and doesn't use excessive ram.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cups-filters/+bug/1920190/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to