[Pkg-cups-devel] Bug#634325: cups-polld does not properly handle network errors, uses 100% CPU in loop

anomie at users.sourceforge.net anomie at users.sourceforge.net
Mon Jul 18 16:23:15 UTC 2011


Package: cups
Version: 1.4.7-1
Tags: patch

If cups-polld runs into a network error after connecting to a remote IPP
server while polling, it will wind up in an endless loop using 100% CPU.
This can be quickly tested using the following procedure:

  1. Configure cups with BrowsePoll to poll a remote server
  2. Use strace on the cups-polld instance for the remote server
  3. Use iptables to block responses from the server, e.g.
      iptables -I INPUT 1 -p tcp -s 192.2.0.2 --sport ipp -j REJECT --reject-with tcp-reset
  4. Wait for the strace to show that cups-polld is blocking in recvfrom
  5. Use iptables to send RST on packets to the server, e.g.
      iptables -I OUTPUT 1 -p tcp -d 192.2.0.2 --dport ipp -j REJECT --reject-with tcp-reset
  6. Wait until TCP decides it has waited too long for an ACK and
     resends the packet.
  7. Observe that the recvfrom now fails with ECONNRESET, and then
     strace outputs lines like the following until the process is killed:
      recvfrom(6, "", 2048, 0, NULL, NULL)   = 0

Note that step 5 may be skipped, in which case you have to wait until
the TCP connection times out in step 6. In the wild, this sort of
situation may occur if the machine is suspended or if the network
connection goes down at the wrong time.

This appears to be the same as
https://bugzilla.redhat.com/show_bug.cgi?id=720921, and the patch
extracted from
http://pkgs.fedoraproject.org/gitweb/?p=cups.git;a=commitdiff;h=a8d53773cf4e1014d4fbb065ab6f0ea480184de9
seems to work. I've attached the actual patch to this message, which
should be importable with quilt import -p1.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cups-polld-prevent-endless-loop.patch
Type: text/x-diff
Size: 274 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-cups-devel/attachments/20110718/2dfbe59c/attachment.patch>


More information about the Pkg-cups-devel mailing list