Skip to content

Commit

Permalink
NXDOMAIN errors should not be retried
Browse files Browse the repository at this point in the history
The standard retryer keeps retrying domains that do not resolve. This
hangs the execution until retries are exhausted.
NXDOMAIN or 'no such host' errors are not transient and should fail immediately.
An example would be when a user enters an invalid region that doesn't resolve.
  • Loading branch information
rem7 committed Apr 6, 2023
1 parent e2147ef commit 9bebecc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aws/retry/retryable_error.go
Expand Up @@ -95,8 +95,13 @@ func (r RetryableConnectionError) IsErrorRetryable(err error) aws.Ternary {
var timeoutErr interface{ Timeout() bool }
var urlErr *url.Error
var netOpErr *net.OpError
var dnsError *net.DNSError

switch {
case errors.As(err, &dnsError):
// NXDOMAIN errors should not be retried
retryable = !dnsError.IsNotFound && dnsError.IsTemporary

case errors.As(err, &conErr) && conErr.ConnectionError():
retryable = true

Expand Down

0 comments on commit 9bebecc

Please sign in to comment.