Bug 490943

Summary: cups doesn't pick up printers on network change
Product: [Fedora] Fedora Reporter: Matthias Clasen <mclasen>
Component: glibcAssignee: Andreas Schwab <schwab>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: jakub, pmuller, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-06-28 11:30:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 446451, 516995    
Attachments:
Description Flags
cupsd.conf none

Description Matthias Clasen 2009-03-18 16:33:52 UTC
Every day I get on the vpn in the office, and when I want to print something, the print dialog shows my home printer (correctly marked as unplugged or offline), and none of the office printers. I do have the correct BrowsePoll entry in cupsd.conf. Restarting cups makes all the printers appear. It would be really nice if that wasn't necessary. 

Can we make cups listen for network changes and be smart about this ?

Comment 1 Tim Waugh 2009-03-19 11:00:11 UTC
Surely not bug #354071 *again*?

Comment 2 Tim Waugh 2009-03-19 11:40:25 UTC
Hmm, I can't reproduce this here with the same recipe as for bug #354071.  That bug was that we didn't reinitialise the resolver before a lookup if it failed last time, so lookups that failed before the correct nameserver was added to /etc/resolv.conf were still failing (our resolver doesn't watch for changes to that file).

Please attach /etc/cups/cupsd.conf.

Comment 3 Matthias Clasen 2009-03-21 15:43:18 UTC
Created attachment 336164 [details]
cupsd.conf

Comment 4 Tim Waugh 2009-03-23 12:53:44 UTC
You should be able to see output from this:

  grep '^E.*cups-polld' /var/log/cups/error_log

Can you let me know what the error messages are?

Comment 5 Matthias Clasen 2009-03-23 16:40:26 UTC
error_log has tons and tons of

E [23/Mar/2009:12:36:55 -0400] [cups-polld cups.bos.redhat.com:631] Unable to connect to cups.bos.redhat.com on port 631: Host name lookup failure
E [23/Mar/2009:12:37:25 -0400] [cups-polld cups.bos.redhat.com:631] Unable to connect to cups.bos.redhat.com on port 631: Host name lookup failure
E [23/Mar/2009:12:37:55 -0400] [cups-polld cups.bos.redhat.com:631] Unable to connect to cups.bos.redhat.com on port 631: Host name lookup failure
E [23/Mar/2009:12:38:25 -0400] [cups-polld cups.bos.redhat.com:631] Unable to connect to cups.bos.redhat.com on port 631: Host name lookup failure
E [23/Mar/2009:12:38:55 -0400] [cups-polld cups.bos.redhat.com:631] Unable to connect to cups.bos.redhat.com on port 631: Host name lookup failure

While at the same time, dig cups.bos.redhat.com finds it just fine.

Comment 6 Tim Waugh 2009-03-23 18:09:02 UTC
What's going on in general here is that when cups-polld started, you didn't have nameservers for the VPN.  At this point, resolving cups.bos.redhat.com fails.  However, glibc will remember that there is no way to resolve that hostname and future calls will *also* fail.

Then, once the VPN is up and the nameserver added to /etc/resolv.conf, newly started applications can start to resolve VPN hosts.  But cups-polld can't, because the glibc resolver still remembers not to try resolving that hostname.

The fix is to get cups-polld to call res_init() each time it resolves the hostname if it failed last time, and that's what we've done for Fedora 9 and 10.

However, it has now broken in Fedora 11.  The reason seems to be that getaddrinfo() is no longer returning EAI_FAIL in this case, but EAI_AGAIN -- *and* it is still caching the failure.

It seems quite wrong to me that EAI_AGAIN is saying "try again, but reinitialise the resolver first" -- this is meant to be indicating a *temporary* failure and so the failure should not be cached.  At least, that seems to be what common sense would dictate; perhaps the standard says something different.

So, holding off judgement for the moment on whether this is a cups bug or a glibc bug, I've built cups-1.4-0.b2.12.fc11 which will reinitalise the resolver if it sees EAI_AGAIN.

Changing component to glibc:

Is getaddrinfo() returning the wrong error code in this situation?

Comment 7 Bug Zapper 2009-06-09 12:21:38 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 8 Tim Waugh 2010-02-23 10:43:29 UTC
This is still behaving in the same way: see bug #567353.

Is getnameinfo/getaddrinfo() returning the wrong error code in this situation?

Comment 9 Bug Zapper 2010-04-27 13:15:25 UTC
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 10 Bug Zapper 2010-06-28 11:30:58 UTC
Fedora 11 changed to end-of-life (EOL) status on 2010-06-25. Fedora 11 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.