Skip to content

Commit

Permalink
br: avoid retry if it's ec2metadata (#47651) (#47789)
Browse files Browse the repository at this point in the history
close #47650
  • Loading branch information
ti-chi-bot authored Oct 19, 2023
1 parent 7305408 commit 0540e51
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 @@ -965,14 +965,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 0540e51

Please sign in to comment.