Bug 1164854

Summary: When access is restricted, cups-polld retries polling multiple times per second
Product: Red Hat Enterprise Linux 6 Reporter: jstephen
Component: cupsAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: jpopelka, psklenar, tlavigne
Target Milestone: rcKeywords: Patch, Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: cups-1.4.2-69.el6 Doc Type: Bug Fix
Doc Text:
When the BrowsePoll configuration directive was used and the remote server configured for polling forbade access, the cups-polld process retried accessing immediately in a busy loop. The process consumed all processor time and increased network traffic. With this update, a mandatory delay of ten seconds has been introduced to prevent that. Affected users should also fix their configuration by removing the BrowsePoll line for the server, or adjusting the server to allow remote queries.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 06:54:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jstephen 2014-11-17 17:44:40 UTC
Description of problem:
RHEL6 CUPS Client configured to BrowsePoll will cause cups-polld to go into a continuous loop when access is restricted on the CUPS server. This was reproduced using a CUPS client and server on different networks.

The below messages are printed multiple times per second.

Client error_log:

        E [11/Nov/2014:13:53:23 -0500] [cups-polld 192.168.100.166:631] CUPS-Get-Printers failed: Forbidden
        E [11/Nov/2014:13:53:23 -0500] [cups-polld 192.168.100.166:631] CUPS-Get-Printers failed: Forbidden
        E [11/Nov/2014:13:53:23 -0500] [cups-polld 192.168.100.166:631] CUPS-Get-Printers failed: Forbidden
        E [11/Nov/2014:13:53:23 -0500] [cups-polld 192.168.100.166:631] CUPS-Get-Printers failed: Forbidden
        E [11/Nov/2014:13:53:23 -0500] [cups-polld 192.168.100.166:631] CUPS-Get-Printers failed: Forbidden
        E [11/Nov/2014:13:53:23 -0500] [cups-polld 192.168.100.166:631] CUPS-Get-Printers failed: Forbidden

This appears to be a regression:


$ diff -up ./cups-1.4.2-rhel-6.5/scheduler/cups-polld.c ./cups-1.4.2-rhel-6.6/scheduler/cups-polld.c
--- ./cups-1.4.2-rhel-6.5/scheduler/cups-polld.c	2008-01-07 16:12:17.000000000 -0800
+++ ./cups-1.4.2-rhel-6.6/scheduler/cups-polld.c	2014-11-14 14:51:21.549278483 -0800
@@ -297,6 +297,7 @@ poll_server(http_t      *http,		/* I - H
     fprintf(stderr, "ERROR: %s CUPS-Get-Printers failed: %s\n", prefix,
             cupsLastErrorString());
     ippDelete(response);
+    restart_polling = 1;
     return (-1);
   }

$ git status
# On branch rhel-6.6

$ grep restart_polling *.patch
cups-polld-reconnect.patch:+    restart_polling = 1;

The changelog in cups.spec contains:

    # cups-polld: reconnect on error (bug #769292).
    %patch96 -p1 -b .polld-reconnect


Version-Release number of selected component (if applicable):
cups-1.4.2-67.el6

How reproducible:
Very

Steps to Reproduce:
1. Configure CUPS Server to share printers only on the same network(Allow @LOCAL)
2. Configure CUPS Client to 'BrowsePoll CUPS Server'

Actual results:
cups-polld retries continuosly with no sleep in between

Expected results:
While I worked around the problem by setting the access permissions correctly on the cups server, the client certainly should not DOS the server if access is denied.


Additional info:

Comment 2 Tim Waugh 2014-11-18 12:11:09 UTC
We aren't sleeping when we loop because restart_polling is 1:

   /*
    * Sleep for any remaining time...
    */

    if (remain > 0 && !restart_polling)
      sleep(remain);

But we do need to sleep in order to prevent this busy loop, so I'd suggest

    else if (restart_polling)
      sleep(10);

There is no equivalent upstream fix as cups-polld.c was removed with this bug still remaining as far as I can tell.

Comment 3 jstephen 2014-12-08 23:03:31 UTC
Hello,

I have tested the patch and it resolved this issue in my testing.

E [05/Dec/2014:08:36:18 -0500] [cups-polld 192.168.100.173:631] CUPS-Get-Printers failed: Forbidden
E [05/Dec/2014:08:36:28 -0500] [cups-polld 192.168.100.173:631] CUPS-Get-Printers failed: Forbidden
E [05/Dec/2014:08:36:38 -0500] [cups-polld 192.168.100.173:631] CUPS-Get-Printers failed: Forbidden
E [05/Dec/2014:08:36:48 -0500] [cups-polld 192.168.100.173:631] CUPS-Get-Printers failed: Forbidden
E [05/Dec/2014:08:36:58 -0500] [cups-polld 192.168.100.173:631] CUPS-Get-Printers failed: Forbidden

- Justin

Comment 8 errata-xmlrpc 2015-07-22 06:54:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1346.html