Bug 1003637

Summary: inst.repo=http://download.fedoraproject.org might end up with "No more mirrors to try"
Product: [Fedora] Fedora Reporter: Kamil Páral <kparal>
Component: yumAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: admiller, anaconda-maint-list, dshea, g.kaviyarasu, jonathan, jzeleny, mkolman, packaging-team-maint, robatino, sbueno, tflink, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-29 12:19:15 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:
Attachments:
Description Flags
anadonda error screenshot
none
anaconda.log
none
anaconda-yum.conf
none
packaging.log
none
program.log
none
storage.log
none
syslog
none
anaconda.repo none

Description Kamil Páral 2013-09-02 14:25:23 UTC
Created attachment 792866 [details]
anadonda error screenshot

Description of problem:
Here's the test case:
https://fedoraproject.org/wiki/QA:Testcase_install_repository_HTTP/FTP_variation

I used
inst.repo=http://download.fedoraproject.org/pub/fedora/linux/development/20/x86_64/os/ 

In earlier releases, it used to work the same way as yum repo works - it expected that the URL can be a redirect (it is), so it resolved it first (it points to a random mirror), and then operated only on this new URL (the single mirror).

I received this instead:
13:44:18,129 DEBUG packaging: http://download.fedoraproject.org/pub/fedora/linux/development/20/x86_64/os/Packages/o/openssl-1.0.1e-18.fc20.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found

It seems that anaconda/yum no longer resolves this redirect, but uses download.fp.o for every request. Of course, that might often result in missing files, because not all mirrors are fully synced all the time. If you get metadata from mirror 1, but download packages from mirror 2, you get these errors.

Of course, this might not happen every time, you have to be "lucky".

Version-Release number of selected component (if applicable):
anaconda 20.9-1
F20 Alpha TC2 x86_64 netinst

How reproducible:
probably just sometimes, I saw this in 2 out of 4 attempts

Steps to Reproduce:
1. boot with inst.repo=http://download.fedoraproject.org/pub/fedora/linux/development/20/x86_64/os/ 
2. start installation, maybe receive error

Actual results:
the original url is used for all requests

Expected results:
the url is checked first for redirects, the resulting url is used for all requests

Additional info:
I received the error after my disk layout has been modified by Anaconda. That's unfortunate.
I'm not sure how many people is affected, but this repo can be very often used in automated deployments. I very much assume this is used in Beaker in Red Hat. The private mirror is used, if available, otherwise some close public repo is used instead, all automatically using download.fp.o.

Comment 1 Kamil Páral 2013-09-02 14:27:05 UTC
Created attachment 792875 [details]
anaconda.log

Comment 2 Kamil Páral 2013-09-02 14:27:11 UTC
Created attachment 792876 [details]
anaconda-yum.conf

Comment 3 Kamil Páral 2013-09-02 14:27:22 UTC
Created attachment 792877 [details]
packaging.log

Comment 4 Kamil Páral 2013-09-02 14:27:28 UTC
Created attachment 792878 [details]
program.log

Comment 5 Kamil Páral 2013-09-02 14:27:34 UTC
Created attachment 792879 [details]
storage.log

Comment 6 Kamil Páral 2013-09-02 14:27:42 UTC
Created attachment 792880 [details]
syslog

Comment 7 Kamil Páral 2013-09-02 14:27:48 UTC
Created attachment 792881 [details]
anaconda.repo

Comment 8 Kamil Páral 2013-09-02 14:29:22 UTC
This might and might not be violating https://fedoraproject.org/wiki/Fedora_20_Alpha_Release_Criteria#remote-package-sources and might and might not be considered serious enough to block Alpha/Beta/Final. Proposing for discussion.

Comment 9 Tim Flink 2013-09-03 14:25:18 UTC
I thought that download.fedoraproject.org shouldn't be used for an installation or upgrade source as you end up getting packages from any number of mirrors, doing an implicit mirror lookup every time.

Comment 10 Kamil Páral 2013-09-04 10:42:26 UTC
(In reply to Tim Flink from comment #9)
No, not really. It's even in official repo files as baseurl (they are commented out because mirrorlist urls are recommended as default, but it's there):

$ grep baseurl /etc/yum.repos.d/fedora.repo 
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/

Yum itself handles this well. The only problem I encountered was with fedup and instrepo (bug 886021), but that was kind of waived. Anaconda used to work correctly before. This is the simplest way to provide a http mirror without actually determining a concrete mirror manually.

Of course, we had a similar issue in AutoQA, because we don't download packages using yum code but manually, but that's not relevant here.

In case I'm mistaken, adding Zdenek Pavlas for an advice.

Comment 11 Zdeněk Pavlas 2013-09-04 11:00:09 UTC
> 13:44:18,129 DEBUG packaging: http://download.fedoraproject.org/pub/fedora/linux/development/20/x86_64/os/Packages/o/openssl-1.0.1e-18.fc20.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found

> It seems that anaconda/yum no longer resolves this redirect..

Please note that 404 is NOT a redirect!  urlgrabber/curl in the default configuration handles redirects transparently, so this 404 was probably generated after the redirection.

And yes, download.fedoraproject.org redirects, so this seems to prove that there's nothing wrong with redirect handling..

$ telnet download.fedoraproject.org 80
HEAD /pub/fedora/linux/development/20/x86_64/os/Packages/o/openssl-1.0.1e-18.fc20.x86_64.rpm HTTP/1.1
Host: download.fedoraproject.org 

HTTP/1.1 302 FOUND
Date: Wed, 04 Sep 2013 10:55:06 GMT
Server: Apache/2.2.15 (Red Hat)
cache-control: no-cache
location: http://download.eng.brq.redhat.com/pub/fedora/linux/development/20/x86_64/os/Packages/o/openssl-1.0.1e-18.fc20.x86_64.rpm
AppTime: D=33625
AppServer: mirrorlist-phx2.phx2.fedoraproject.org
Content-Type: text/html; charset=utf-8
ProxyTime: D=9690355
ProxyServer: proxy06.fedoraproject.org

Connection closed by foreign host.

Comment 12 Zdeněk Pavlas 2013-09-04 11:29:29 UTC
When you configure a single baseurl that redirects to 10 mirrors, urlgrabber sees just a single mirror. The default failover method is to try all available mirror, so with a single URL that redirects to a mirror that 404s, we give up immediately.

Probably something like this would help: http://yum.baseurl.org/gitweb?p=yum.git;a=commitdiff;h=bfb49e

Reuse mirrors when max_retries > len(mirrors).  BZ 765598

Comment 13 Kamil Páral 2013-09-04 12:55:23 UTC
I'm not sure that we understand each other. If I use baseurl=download.fp.o during installation, we need to ensure that we use a the same mirror for retrieving metadata and retrieving packages. The 404 indicates that metadata were retrieved from mirror 1, but the openssl package was most probably attempted to be retrieved from mirror 2 (which was not in sync with mirror 1).

I really believe Anaconda (and the included yum) used to resolve download.fp.o first, remember the resulting mirror URL, and then download all metadata & packages from this $URL. Therefore there were no 404 errors. Am I completely wrong, Zdenek?

Comment 14 Zdeněk Pavlas 2013-09-04 13:20:19 UTC
"302 FOUND" processing is done in curl, and is transparent to urlgrabber/yum/anaconda. If you think that 302 redirects were originally cached, it might be due to:

a) a bug in curl. According to http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.3 clients should NOT cache this.

b) download.fedoraproject.org might have used to send a different cache-control header.

I still don't think we (the client) should 1) handle redirects 2) do it in a non-compliant way.

Comment 15 Kamil Páral 2013-09-04 14:35:45 UTC
In that case, I'm removing AlphaBlocker nomination, since this is not a clear-cut bug anymore. If this is not handled inside yum and never was, then there must have been other circumstances causing "correct" behavior (as Zdenek mentions), or I must have been extremely lucky to never see this bug.

I'll try to investigate some more to check F17/F18 anaconda behavior and yum itself behavior.

Comment 16 Zdeněk Pavlas 2013-09-04 15:03:48 UTC
Now I realized that redirect "caching" involves URLs, not hostnames, and URL obviously changes.. we first ask for repomd.xml, then metadata, then packages.

The location we were redirected previously is thus irrelevant, cached or not. So we're left with two ways to fix this:

a) implement same-mirror retries, and hope that we hit the "right" mirror soon.

b) make the redirect choice at download.fp.o random, but mapping client IPs to mirrors consistently.

Comment 17 Fedora End Of Life 2015-05-29 09:21:31 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. 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 EOL if it remains open with a Fedora  'version'
of '20'.

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.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 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, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

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.

Comment 18 Fedora End Of Life 2015-06-29 12:19:15 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 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. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

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