Skip to content

Commit

Permalink
br: avoid retry if it's ec2metadata (#47651) (#47790)
Browse files Browse the repository at this point in the history
close #47650
  • Loading branch information
ti-chi-bot authored Oct 26, 2023
1 parent 121910d commit 06c954c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions br/pkg/storage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,14 +969,14 @@ func (rl retryerWithLog) ShouldRetry(r *request.Request) bool {
r.Error = errors.New("read tcp *.*.*.*:*->*.*.*.*:*: read: connection reset by peer")
}
})
if isConnectionResetError(r.Error) {
return true
}
if isDeadlineExceedError(r.Error) && r.HTTPRequest.URL.Host == ec2MetaAddress {
if r.HTTPRequest.URL.Host == ec2MetaAddress && (isDeadlineExceedError(r.Error) || isConnectionResetError(r.Error)) {
// fast fail for unreachable linklocal address in EC2 containers.
log.Warn("failed to get EC2 metadata. skipping.", logutil.ShortError(r.Error))
return false
}
if isConnectionResetError(r.Error) {
return true
}
return rl.DefaultRetryer.ShouldRetry(r)
}

Expand Down

0 comments on commit 06c954c

Please sign in to comment.