Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1327810 - Option "printcap cache time = 1" doesn't have any impact
Option "printcap cache time = 1" doesn't have any impact
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: samba (Show other bugs)
7.2
All Linux
unspecified Severity medium
: rc
: ---
Assigned To: Andreas Schneider
Robin Hack
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-04-15 21:21 EDT by Robert Scheck
Modified: 2017-08-01 14:19 EDT (History)
6 users (show)

See Also:
Fixed In Version: samba-4.6.0-0.1.rc3.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-01 14:19:59 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:1950 normal SHIPPED_LIVE Low: samba security, bug fix, and enhancement update 2017-08-01 14:09:24 EDT

  None (edit)
Description Robert Scheck 2016-04-15 21:21:55 EDT
Description of problem:
According to "man smb.conf":

--- snipp ---
  printcap cache time (G)

      This option specifies the number of seconds before the printing
      subsystem is again asked for the known printers.

      Setting this parameter to 0 disables any rescanning for new or
      removed printers after the initial startup.

      Default: printcap cache time = 750

      Example: printcap cache time = 600
--- snapp ---

Conclusion: "printcap cache time = 1" should check every second, right?

$ lpadmin -p test -v socket://test -D test -E
$ while [ true ]; do
>   date
>   rpcclient localhost -U printadmin%printadmin -c 'enumprinters' | grep test
>   sleep 1
> done
Sa 16. Apr 02:57:00 CEST 2016
Sa 16. Apr 02:57:01 CEST 2016
Sa 16. Apr 02:57:02 CEST 2016
Sa 16. Apr 02:57:03 CEST 2016
Sa 16. Apr 02:57:04 CEST 2016
Sa 16. Apr 02:57:05 CEST 2016
Sa 16. Apr 02:57:06 CEST 2016
Sa 16. Apr 02:57:07 CEST 2016
Sa 16. Apr 02:57:08 CEST 2016
Sa 16. Apr 02:57:09 CEST 2016
Sa 16. Apr 02:57:10 CEST 2016
Sa 16. Apr 02:57:12 CEST 2016
Sa 16. Apr 02:57:13 CEST 2016
Sa 16. Apr 02:57:14 CEST 2016
Sa 16. Apr 02:57:15 CEST 2016
Sa 16. Apr 02:57:16 CEST 2016
Sa 16. Apr 02:57:17 CEST 2016
Sa 16. Apr 02:57:18 CEST 2016
Sa 16. Apr 02:57:19 CEST 2016
Sa 16. Apr 02:57:20 CEST 2016
Sa 16. Apr 02:57:21 CEST 2016
Sa 16. Apr 02:57:22 CEST 2016
Sa 16. Apr 02:57:23 CEST 2016
Sa 16. Apr 02:57:24 CEST 2016
Sa 16. Apr 02:57:25 CEST 2016
Sa 16. Apr 02:57:26 CEST 2016
Sa 16. Apr 02:57:27 CEST 2016
Sa 16. Apr 02:57:28 CEST 2016
Sa 16. Apr 02:57:29 CEST 2016
Sa 16. Apr 02:57:30 CEST 2016
Sa 16. Apr 02:57:31 CEST 2016
Sa 16. Apr 02:57:32 CEST 2016
Sa 16. Apr 02:57:34 CEST 2016
Sa 16. Apr 02:57:35 CEST 2016
Sa 16. Apr 02:57:36 CEST 2016
Sa 16. Apr 02:57:37 CEST 2016
Sa 16. Apr 02:57:38 CEST 2016
Sa 16. Apr 02:57:39 CEST 2016
Sa 16. Apr 02:57:40 CEST 2016
Sa 16. Apr 02:57:41 CEST 2016
Sa 16. Apr 02:57:42 CEST 2016
Sa 16. Apr 02:57:43 CEST 2016
Sa 16. Apr 02:57:44 CEST 2016
Sa 16. Apr 02:57:45 CEST 2016
Sa 16. Apr 02:57:46 CEST 2016
Sa 16. Apr 02:57:47 CEST 2016
Sa 16. Apr 02:57:48 CEST 2016
Sa 16. Apr 02:57:49 CEST 2016
Sa 16. Apr 02:57:50 CEST 2016
Sa 16. Apr 02:57:51 CEST 2016
Sa 16. Apr 02:57:52 CEST 2016
Sa 16. Apr 02:57:53 CEST 2016
Sa 16. Apr 02:57:54 CEST 2016
Sa 16. Apr 02:57:56 CEST 2016
Sa 16. Apr 02:57:57 CEST 2016
Sa 16. Apr 02:57:58 CEST 2016
Sa 16. Apr 02:57:59 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
Sa 16. Apr 02:58:00 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
Sa 16. Apr 02:58:01 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
Sa 16. Apr 02:58:02 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
Sa 16. Apr 02:58:03 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
Sa 16. Apr 02:58:04 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
^C
$ 

Version-Release number of selected component (if applicable):
samba-4.2.10-6.el7_2

How reproducible:
Everytime, see above and below.

Actual results:
Option "printcap cache time = 1" doesn't have any impact.

Expected results:
Option "printcap cache time = 1" should work as advertised in the man
page; alternatively it should be documented that the minimum interval
is 60 seconds as it seems (not preferred by me, I would like to see the
faster polling instead).

Additional info:
It does not matter at all whether "printcap name = cups" is set or if
"printcap name = /etc/printcap" is set.
Comment 2 Robert Scheck 2016-04-15 21:49:26 EDT
In source3/printing/pcap.c, there's pcap_cache_reload(), which is called
from source3/printing/queue_process.c using print_queue_housekeeping().
print_queue_housekeeping() depends on SMBD_HOUSEKEEPING_INTERVAL, that is
defined to SMBD_SELECT_TIMEOUT in source3/include/local.h which is finally
#define SMBD_SELECT_TIMEOUT (60).
Comment 3 Robert Scheck 2016-04-16 20:08:16 EDT
In difference to my initial description documenting in the man page the
housekeeping and how the "printcap cache time" works would be also enough,
given a proper reload (see bug #1327845) exists for manual refreshs, too.

Cross-filed case 01618854 on the Red Hat customer portal.
Comment 4 Andreas Schneider 2016-04-18 10:25:48 EDT
I've proposed the following patch:

commit 22634238ae8c36c2faf06afedee12ce1c52bd14a
Author:     Andreas Schneider <asn@samba.org>
AuthorDate: Mon Apr 18 09:29:16 2016 +0200
Commit:     Andreas Schneider <asn@samba.org>
CommitDate: Mon Apr 18 09:29:16 2016 +0200

    docs: Improve documentation for 'printcap cache time'
    
    Signed-off-by: Andreas Schneider <asn@samba.org>
---
 docs-xml/smbdotconf/printing/printcapcachetime.xml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/docs-xml/smbdotconf/printing/printcapcachetime.xml b/docs-xml/smbdotconf/printing/printcapcachetime.xml
index d5a4c80..5b4feda 100644
--- a/docs-xml/smbdotconf/printing/printcapcachetime.xml
+++ b/docs-xml/smbdotconf/printing/printcapcachetime.xml
@@ -4,11 +4,14 @@
                  xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
     <para>This option specifies the number of seconds before the printing
-    subsystem is again asked for the known printers.
+        subsystem is again asked for the known printers. The function is
+        triggered by the housekeeping functions which is executed every 60
+        seconds. This means if set to a value less than 60 seconds the
+        cache is still only reloaded every 60 seconds.
     </para>
 
-    <para>Setting this parameter to 0 disables any rescanning for new 
-    or removed printers after the initial startup.
+    <para>Setting this parameter to 0 disables any rescanning for new or
+        removed printers after the initial startup.
     </para>
 </description>
Comment 5 Robert Scheck 2016-04-18 10:31:57 EDT
Andreas, thank you - sounds suitable to me.
Comment 6 Andreas Schneider 2016-06-08 09:29:25 EDT
The background queue in the meantime only manages the pcap relaod so upstream we changed it to directly use the value from 'printcap cache time'.
Comment 9 errata-xmlrpc 2017-08-01 14:19:59 EDT
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://access.redhat.com/errata/RHSA-2017:1950

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