[PATCH] Same-mirror retry on refused connections. Helps BZ 853432
James Antill
james at fedoraproject.org
Fri Oct 25 16:30:07 UTC 2013
On Fri, 2013-10-25 at 11:45 +0200, Zdenek Pavlas wrote:
> "Connection refused" is usually caused by server being administratively
> down. However, the connection might also be closed by a conn-limiting
> firewall. RST is also sent by kernel when the listening socket's accept()
> queue is full.
>
> Both causes are transient, so maybe it's worth retrying. When this
> assumption is wrong, there's little harm done. Timeouts are much worse,
> and we already retry on timeouts.
Seems fine, but...
> ---
> yum/yumRepo.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/yum/yumRepo.py b/yum/yumRepo.py
> index e371676..0b72cd9 100644
> --- a/yum/yumRepo.py
> +++ b/yum/yumRepo.py
> @@ -631,9 +631,9 @@ class YumRepository(Repository, config.RepoConf):
> def mirror_failure(obj):
> action = {}
>
> - # timeouts and 503 errors may retry
> + # timeout, refused connect, and HTTP 503 may retry
> e = obj.exception
> - if e.errno == 12 or getattr(e, 'code', 0) == 503:
> + if e.errno == 12 or e.errno == 14 and getattr(e, 'code', 0) in (7, 503):
Adding brackets to make this test readable FTW :).
Also we've now gone from:
if e.errno == 12 or (getattr(e, 'code', 0) == 503):
# Do XYZ
...to:
if e.errno == 12 or (e.errno == 14 and (getattr(e, 'code', 0) == 503)):
# Do XYZ
if e.errno == 12 or (e.errno == 14 and (getattr(e, 'code', 0) == 7)):
# Do XYZ
...did we want to change the logic for 503 errors?
More information about the Yum-devel
mailing list