cupsd monopolizes CPU

Bug #59542 reported by jz
0
Affects Status Importance Assigned to Milestone
CUPS
Fix Committed
Undecided
Unassigned
cupsys (Mandriva)
Fix Released
Medium
cupsys (Ubuntu)
Fix Released
High
Martin Pitt

Bug Description

Binary package hint: cupsys

After updating the following packages:

cupsys (1.2.2-0ubuntu4) to 1.2.3-0ubuntu1
cupsys-bsd (1.2.2-0ubuntu4) to 1.2.3-0ubuntu1
cupsys-client (1.2.2-0ubuntu4) to 1.2.3-0ubuntu1
cupsys-common (1.2.2-0ubuntu4) to 1.2.3-0ubuntu1

cupsd uses a great deal of CPU resources as soon as the service is started and does not release them unless it it killed manually.

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

Can you post the following files:

/etc/cups/cupsd.conf
/etc/cups/printers.conf
/etc/cups/client.conf
/etc/cups/ppd/*.ppd

Which printer model do you have and how it is connected?

What does happen if you use the "lpstat" command:

lpstat -p
lpstat -d
lpstat -v

Does it hang and needs to be killed with Ctrl + C?

Can you set "LogLevel debug" in /etc/cups/cupsd.conf, restart CUPS (/etc/init.d/cupsys restart), and then try "lpstat" and printing commands again? Observe "tail -f /var/log/cups/error_log" in a second console window while doing your tests. Does it go into an infinite loop.

I have also observed this problem with an HP DeskJet 3740, set up with HPLIP/HPIJS and set as the default printer. I observe CUPS going into an infinite loop when running any "lpstat" command.

The bug seems to be an upstream problem, as it was also reported to Mandriva:

http://qa.mandriva.com/show_bug.cgi?id=25186

No one reported it directly upstream though.

Changed in cupsys:
status: Unconfirmed → Needs Info
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Revision history for this message
jz (jz+) wrote :

/etc/cups/cupsd.conf

#
#
# Sample configuration file for the Common UNIX Printing System (CUPS)
# scheduler. See "man cupsd.conf" for a complete description of this
# file.
#

# Log general information in error_log - change "info" to "debug" for
# troubleshooting...
LogLevel warning

# Administrator user group...
SystemGroup lpadmin

# Only listen for connections from the local machine.
Listen localhost:631
Listen /var/run/cups/cups.sock

# Show shared printers on the local network.
Browsing Off
BrowseOrder allow,deny
BrowseAllow @LOCAL
BrowseAddress @LOCAL

# Default authentication type, when authentication is required...
DefaultAuthType Basic

# Restrict access to the server...
<Location />
  Order allow,deny
  Allow localhost
  Allow @LOCAL
</Location>

# Restrict access to the admin pages...
<Location /admin>
  Order allow,deny
  Allow localhost
</Location>

# Restrict access to configuration files...
<Location /admin/conf>
  AuthType Basic
  Require user @SYSTEM
  Order allow,deny
  Allow localhost
</Location>

# Set the default printer/job policies...
<Policy default>
  # Job-related operations must be done by the owner or an adminstrator...
  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  # All administration operations require an adminstrator to authenticate...
  <Limit Pause-Printer Resume-Printer Set-Printer-Attributes Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
    AuthType Basic
    Require user @SYSTEM
    Order deny,allow
  </Limit>

  # Only the owner or an administrator can cancel or authenticate a job...
  <Limit Cancel-Job CUPS-Authenticate-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>

  <Limit All>
    Order deny,allow
  </Limit>
</Policy>

#
#

/etc/cups/printers.conf

# Printer configuration file for CUPS v1.2.0
# Written by cupsd on 2006-07-11 14:55
<Printer ML-2010>
Info
Location
DeviceURI usb://Samsung/ML-2010
State Idle
StateTime 1152644138
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
</Printer>

/etc/cups/client.conf
file not present

/etc/cups/ppd/*.ppd

ppd file attached

The printer is a Samsung ML-2010 laser printer.

admin@hades:~$ lpstat -p
printer ML-2010 is idle. enabled since Tue 11 Jul 2006 02:55:38 PM EDT

admin@hades:~$ lpstat -d
no system default destination

admin@hades:~$ lpstat -v
device for ML-2010: usb://Samsung/ML-2010

more info to come...

Revision history for this message
chantra (chantra) wrote :

same here, here is a file taken from strace -p [cupsd_pid].

Revision history for this message
Ante Karamatić (ivoks) wrote :

I have only i386 arch, so if you have i386 arch as well, add:

deb http://www.grad.hr/~ivoks/ubuntu/cups2/ ./

to /etc/apt/sources.list, do an update/upgrade and report if bug still exist.

If you have amd64/ppc arch, add:

deb-src http://www.grad.hr/~ivoks/ubuntu/cups2/ ./

to /etc/apt/sources.list, do an apt-get update, followed by 'apt-get build-dep cupsys ; apt-get -b source cupsys. This will build cups for you platform, but it will not install it. You need to manually install it (dpkg -i *cups*ivoks*deb; note that this could install packages you didn't have before like cupsys-bsd and/or libcupsys2-dev, so don't forget to remove them or not install them at all :)

Revision history for this message
Ante Karamatić (ivoks) wrote :

Make that 'fakeroot apt-get -b source cupsys' for amd64/ppc.

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

Mike Sweet has posted a patch which is a possible fix for this problem to my upstream bug report:

http://www.cups.org/str.php?L1968

Revision history for this message
Ante Karamatić (ivoks) wrote : Re: [Bug 59542] Re: cupsd monopolizes CPU

Na Pon, 2006-09-11 u 17:06 +0000, Till Kamppeter je napisao:

> Mike Sweet has posted a patch which is a possible fix for this problem
> to my upstream bug report:
>
> http://www.cups.org/str.php?L1968

Right. This packages include that patch.

--
Ante Karamatić <email address hidden>
PGP: 0xD3BDA225

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

So the packages on http://www.grad.hr/~ivoks/ubuntu/cups2/ include it? Thank you for packaging it.

Whoever has observed the bug, please install the mentioned packages and report your experience.

On my Ubuntu Edge the problem does not appear, but tomorrow I can try the patch on a Mandriva box. Unfortunately, not everyone has the problem, so please everyone who reads this, try on whatever OS with CUPS 1.2.3. Thanks.

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

There is also a bug report on Red Hat now:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=205619

The patch proposed by Mike Sweet seems not to solve the problem, as both the Red Hat user and the Mandriva user tried a patched CUPS package and it did not help (but still please test, perhaps there is more than one bug).

The Red Hat report contains strace output and error_log files.

Revision history for this message
chantra (chantra) wrote :

thanks Ante Karamatić for your packages, but infortunately, it doesn't solve the problem for me.

It seems that cupsd behave correctly as long as no other program uses it.
If i start gnome, then gnome-cups-icon makes cupsd runs 100% CPU.
If i kill it, cupsd still run but behave correctly.

Here are 2 screenshots, before killing cups-gnome-icon and after. Once cups-gnome-icon is killed, cupsd cool down.
If i starts gnome-cups-manager, cupsd starts again taking all the CPU.

thanks ante anyway ;)

Revision history for this message
chantra (chantra) wrote :

after killing

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

Can you do

/etc/init.d/cupsys stop

strace -f cupsd > cupsd.log

and then run a program/command which makes CUPS taking 100% CPU (from another terminal or the desktop menues). After the CPU was taken by cupsd for some seconds stop the program and then stop the "strace -f cupsd > cupsd.log" with Ctrl + C.

Post cupsd.log here. If it is too big, try one of the following:

bzip2 cupsd.log
head -10000 cupsd.log cupsd10000.log

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

Sorry, must be

/etc/init.d/cupsys stop
strace cupsd -f > cupsd.log

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

There is a new patch on the upstream report now

http://www.cups.org/str.php?L1968

The Red Hat user reported that it works, I am waiting for the reaction of the Mandriva user.

Revision history for this message
Ante Karamatić (ivoks) wrote :

OK, I've updated packages, so, please upgrade your packages and check if new this new patch works.

Thanks.

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

Upstream bug report is now officially closed as fixed on Subversion by Mike Sweet. He has posted a new and final patch. Ante, if you did not apply that patch yet, please do so.

Jonathan, chantra, wait for Ante's version with the final patch and test.

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

Ante, make sure that your package contains BOTH patches from Mike Sweet and NOT the patch from Tim Waugh.

Revision history for this message
Ante Karamatić (ivoks) wrote :

Na Sri, 2006-09-13 u 19:59 +0000, Till Kamppeter je napisao:

> Ante, make sure that your package contains BOTH patches from Mike Sweet
> and NOT the patch from Tim Waugh.

I noticed that on CUPS mailing list. Well, packages are updated,
containing both patches (none of them is from Tim).

--
Ante Karamatić <email address hidden>
PGP: 0xD3BDA225

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

Jonathan, chantra, now it's your turn. Get the new packages, test them, and report your results here.

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

The Mandriva user

http://qa.mandriva.com/show_bug.cgi?id=25186

reported that Mikes final patches fix the problem.

Martin Pitt (pitti)
Changed in cupsys:
assignee: nobody → pitti
importance: Untriaged → High
status: Needs Info → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

 cupsys (1.2.3-1ubuntu1) edgy; urgency=low
 .
   * Merge recent bug fixes from Debian (see Kenshi's changes in 1.2.3-1 for
     Ubuntu-relevant details). 00_r5958.dpatch has the following fixes from
     upstream:
     - The "All Documents" link in the on-line help was missing a trailing
       slash (STR #1971)
     - The Polish web interface translation used the wrong URLs for the job
       history (STR #1963)
     - The "reprint job" button did not work (STR #1956)
     - The scheduler did not always report printer or job events properly (STR
       #1955)
     - The scheduler always stopped the queue on error, regardless of the exit
       code, if the error policy was set to "stop-printer" (STR #1959)
     - ppdEmitJCL() included UTF-8 characters in the JCL job name, which caused
       problems on some printers (STR #1959)
     - Fixed a buffering problem that cause high CPU usage (STR #1968)
       (Closes: LP#59542)
     - The command-line applications did not convert command-line strings to
       UTF-8 as needed (STR #1958)
     - cupsDirRead() incorrectly aborted when reading a symbolic link that
       pointed to a file/directory that did not exist (STR #1953)
     - The cupsInterpretRasterPPD() function did not handle custom page sizes
       properly.
   * debian/cupsys.init.d: Always make sure that log files have proper
     permissions. Closes: LP#54277

Changed in cupsys:
status: In Progress → Fix Released
Revision history for this message
jz (jz+) wrote :

Issue seems to be fixed in cupsys 1.2.3-1ubuntu1

Revision history for this message
Ante Karamatić (ivoks) wrote :

Hm... This is odd. I didn't have this problems before, but now I do. Huh? 'lpinfo -v' results in 100% proc use. Sometimes it ends, and sometimes it doesn't end even after 1 minute. Strace:

send(4, "\1\1@\v\0\0\0\1\1G\0\22attributes-charset\0\5"..., 75, 0) = 75
getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=1024}) = 0
select(5, [4], NULL, NULL, {1, 0}) = 1 (in [4], left {1, 0})
recv(4, "HTTP/1.1 100 Continue\r\n\r\n", 2048, 0) = 25
time(NULL) = 1158403657
time(NULL) = 1158403657
recv(4,

This is where it stops. It stops every time, but sometimes it finishes quickly, and sometimes I give up waiting. That 'recv' line should end like this:

recv(4, "HTTP/1.1 200 OK\r\nDate: Sat, 16 S"..., 2048, 0) = 206

Changed in cupsys:
status: Unknown → Fix Released
Revision history for this message
Peter Clifton (pcjc2) wrote :

I'm not sure it is the same bug or not, but I'm seeing very similar symptoms on Ubuntu Edgy, with cupsys-1.2.4-2-ubuntu3

Changed in cupsys (Mandriva):
importance: Unknown → Medium
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.