[Yum-devel] yum does not retry on 503 errors

Mike McLean mikem.rtp at gmail.com
Wed Jun 27 19:26:43 UTC 2012


On Wed, Jun 27, 2012 at 5:16 AM, Zdenek Pavlas <zpavlas at redhat.com> wrote:
>> 3) the failure callback that yum gives to urlgrabber /always/
>> re-raises the exception, preventing any possible retries that that
>> level
>>
>> I found #3 the most surprising since yum goes to the trouble of
>> passing the retry option to urlgrabber
>
> Yes, was surprised too when I had discovered this, but the idea
> is that it's often better to try next mirror instead of retrying
> (think of timing out on a dead mirror and retrying that 20 times).

Understood. Especially if the server returns a large retry-after value.

In my case there are no mirrors, so mirror failover as it stands doesn't help.

Perhaps the best way (for yum at least) is to not perform the
configured retries at the grabber level, but at the mirrorgroup level.
That is, allow each mirror to fail $retries times before it is removed
from the list, but still advance to the next mirror on each failure.

> If you return from the Yum failure callback instead, the retry
> logic will work.  Could you try this instead?
...
> diff --git a/output.py b/output.py
> index b3f2c75..4a55357 100755
> --- a/output.py
> +++ b/output.py
> @@ -465,6 +465,9 @@ class YumOutput:
>         :raises: *errobj*.exception
>         """
>         self.logger.error('%s: %s', errobj.url, errobj.exception)
> +        if errorobj.exception.code == 503:
> +            errorobj.exception.errno = -1
> +            return
>         self.logger.error(_('Trying other mirror.'))
>         raise errobj.exception
>
> Unfortunately, urlgrabber caches errno, we can't change it
> in callback.. Have to patch it too:

Alternately, if going this route, yum could just add 14 to retrycodes
and not need to change errno.


More information about the Yum-devel mailing list