Skip to content

Commit b1301cd

Browse files
committed
CORS-4078: bump AWS SDK v2 max backoff duration to 300s
In AWS SDK v2, the SDK implements an exponential backoff and jitter but with a 20s max backoff duration. This can cause the installer to aggressively retry. In SDK v1, this value was 300s. Thus, bumping the max backoff duration back to 300s as it was a good fit for the installer previously. Reference: SDK v2: https://github.com/aws/aws-sdk-go-v2/blob/88da3c8c5569dece0e99802dab638faa047a0db0/aws/retry/standard.go#L30-L31 SDK v1: https://github.com/aws/aws-sdk-go/blob/070853e88d22854d2355c2543d0958a5f76ad407/aws/client/default_retryer.go#L48-L49
1 parent 1fbf7f2 commit b1301cd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/asset/installconfig/aws/sessionv2.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"os"
77
"path/filepath"
88
"sync"
9+
"time"
910

1011
survey "github.com/AlecAivazis/survey/v2"
1112
"github.com/aws/aws-sdk-go-v2/aws"
@@ -31,6 +32,9 @@ const (
3132

3233
// RetryMaxAttempts is the total number of times an API request is retried.
3334
RetryMaxAttempts = 25
35+
36+
// RetryBackoffDuration is max duration between retried attempts.
37+
RetryBackoffDuration = 300 * time.Second
3438
)
3539

3640
var (
@@ -47,6 +51,12 @@ func getDefaultConfigOptions() ConfigOptions {
4751
return retry.NewStandard(func(so *retry.StandardOptions) {
4852
so.MaxAttempts = RetryMaxAttempts
4953

54+
// The SDK v2 implements exponential backoff and jitter by default, but with 20s max backoff duration,
55+
// which can cause the installer to aggressively retry.
56+
// Thus, setting this to a higher value to allow more rest time and ease AWS API load.
57+
// In SDK v1, this value was also 300s: https://github.com/hashicorp/terraform-provider-aws/issues/36837
58+
so.Backoff = retry.NewExponentialJitterBackoff(RetryBackoffDuration)
59+
5060
// The SDK v2 introduces a new client-side rate-limiting mechanism in the standard retry.
5161
// The default settings are not a good fit for the installer, especially the destroy code.
5262
// Until we figure out a good settings, we disable it to align with SDK v1 behavior.

0 commit comments

Comments
 (0)