[PATCH] Same-mirror retry on refused connections. Helps BZ 853432

Zdenek Pavlas zpavlas at redhat.com
Fri Oct 25 09:45:28 UTC 2013


"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.
---
 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):
                 tries = getattr(obj, 'tries', self.retries)
                 if tries <= self.retries - len(self.urls):
                     # don't remove this mirror yet
-- 
1.7.11.7



More information about the Yum-devel mailing list