Bug 1191691 - cups-browsed very inefficient
Summary: cups-browsed very inefficient
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cups-filters
Version: 7.1
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Tim Waugh
QA Contact: qe-baseos-daemons
Depends On:
Blocks: 1110700 1191021
TreeView+ depends on / blocked
Reported: 2015-02-11 18:34 UTC by Tim Waugh
Modified: 2015-11-19 12:08 UTC (History)
3 users (show)

Fixed In Version: cups-filters-1.0.35-18.el7
Doc Type: Bug Fix
Doc Text:
Cause: Local and remote CUPS schedulers were asked for information repeatedly with no cache. Consequence: Excess load was placed on local and remote CUPS schedulers. Fix: The information is now cached during each poll. Result: CUPS scheduler load is reduced.
Clone Of:
Last Closed: 2015-11-19 12:08:02 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2360 normal SHIPPED_LIVE Moderate: cups-filters security, bug fix, and enhancement update 2015-11-19 10:41:12 UTC
Red Hat Bugzilla 1223719 None CLOSED Cups is not pulling Description of Printers from Cups server 2019-03-18 12:57:17 UTC

Internal Links: 1223719

Description Tim Waugh 2015-02-11 18:34:35 UTC
Description of problem:
Upstream revisions 7314--7324 fix several inefficient code paths in cups-browsed:

- when listening for CUPS Browsing packets, cupsGetDests() is called each time a packet is received, fetching the entire list of local printers
- when using BrowsePoll, cupsGetDests() is called for each remote printer discovered
- when sending CUPS Browsing packets, cupsGetDests() is called each BrowseInterval

The fixes (a) fix IPP notification handling and (b) use it to track changes in local printers. If there are no changes, recomputing is avoided.

This takes load off cupsd as well as cups-browsed.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Run 'cupsctl --debug-logging' (as root)
2.Run 'cups-browsed --debug' (as root)
3.Watch /var/log/cups/error_log to see how many times CUPS-Get-Printers is requested

Actual results:
Happens in the situations described above.

Expected results:
Only happens after changes to the local printers.

Additional info:
Recommend just using the latest utils/cups-browsed.c. It also fixes several instances of searching through lists for things that should be in hash tables, etc.

Comment 1 Zdenek Kabelac 2015-06-05 07:55:27 UTC
I'd add couple comments here -

cups-browsed seems to be the only 'permanent'daemon process which is able to keep my fan spinning.

IMHO - it really should do any  'ipp' processing only when it's really queried for some list of printers.

i.e.  I print something just few times per month - yet - long office printer list is processed with poor slow CPU hunger parser every minute.
And not just that - even my '/etc/hosts' file with longer list of blocked sites seems to be scanned every minute because of this.

Would be very cool to see 'browsed' only collecting list of printers addresses - and processing them just when needed  (thus just following systemd design) - I've no problem to get the list of printers some miliseconds later...

Comment 2 Tim Waugh 2015-06-08 16:25:17 UTC
FWIW: The "right" way of doing this is not to use cups-browsed at all. It is only there for applications that do not use libcups (and its client-side DNS-SD discovery), and instead use their own discovery by querying the local cupsd process, expecting that cupsd does discovery (it doesn't, since 1.6).

If all the applications did it this way, discovery would be entirely on demand.

Comment 5 errata-xmlrpc 2015-11-19 12:08:02 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.


Note You need to log in before you can comment on or make changes to this bug.