New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default retry behaviour includes HTTP 4xx client errors #833
Comments
Hey, I mentioned this on one of the fog-aws issues, but I think the main potential use case that I can recall is to smooth eventual consistency. ie a NotFound is retried, with some delay, making it so the end user doesn't have to necessarily deal with that themselves. (or at least I believe that was my intention back then). To your points though, there are a few problems with this.
It's possible that the right approach might be to separate out the eventual consistency stuff and handle that specifically in fog-aws (and not here where it's rarely applicable). That could also give us more flexibility/leverage to make it configurable. What do you think? |
That sounds a promising path - I'd been starting to think along similar lines – that trying to cover off the eventual consistency case as the default behaviour in a HTTP library feels like overstretching. Default retry of anything is somewhat surprising when compared with other HTTP libraries, to my knowledge, all of net-http/httparty/faraday/curl/python-requests/js-fetch/axios require some form of explicit opt-in to get any retry. At the fog service level, where waiting on eventual consistency is something that might be desirable, it feels like something that would benefit from specific affordances that call out exactly what's going on. A good comparison is the AWS Ruby SDK's waiters pattern: ec2 = Aws::EC2::Client.new
ec2.wait_until(:instance_running, instance_ids:['i-12345678']) |
@rahim yeah, in fog there is the somewhat similar I don't think there should be any retries by default though. The middleware is loaded by default, but I believe the actual retry is based on the truthiness of |
Ah, thank you - that was a detail I'd missed. When I was reviewing the various fog retry behaviours it sounds like I ought to have been grepping for where that idempotent flag got set too. |
No worries, it's pretty easy to overlook I think. |
This issue has been marked inactive and will be closed if no further activity occurs. |
See fog/fog-aws#690 for background on how I stumbled on this. I opened a PR in fog-aws to configure round this, but it feels like something that might be better addressed here.
#690 added the ability to configure which errors were retried.
Excon sets the following for
retry_errors
excon/lib/excon/constants.rb
Lines 19 to 23 in 85556ae
Client
,Success
,Redirection
,Informational
andServer
are all descendants ofExcon::Error::HTTPStatus
.excon/lib/excon/error.rb
Lines 68 to 125 in 85556ae
Incomplete tree for some additional context:
In terms of descendants of
HttpStatus
I struggle to think of situations where retrying anything other thanExcon::Error::Server
and perhapsExcon::RequestTimeout
andExcon::TooManyRequests
could be useful. Blanketing the failures is certainly the conservative choice here though, there's surely scenarios I've just not had the imagination to think up.When
retry_interval
is 0 (as is the case in Excon's default configuration), these choices tend to have minimal impact because repeat queries are typically so fast, but when the interval is increased waiting on retries for scenarios we have no reason to believe would change becomes a cost.My suggestion is that we set
Possibly also including
Excon::RequestTimeout
andExcon::TooManyRequests
.I'm happy to open a PR if there's agreement this is a reasonable approach.
The text was updated successfully, but these errors were encountered: