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 5, 2023
1 parent 296e005 commit e62d0a0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aws/retry/retryable_error.go
Original file line number Diff line number Diff line change
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 = false

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

Expand Down

0 comments on commit e62d0a0

Please sign in to comment.