diff --git a/br/pkg/storage/gcs.go b/br/pkg/storage/gcs.go index c5796e70d9c7a..5da5c29d34ac6 100644 --- a/br/pkg/storage/gcs.go +++ b/br/pkg/storage/gcs.go @@ -8,6 +8,7 @@ import ( goerrors "errors" "fmt" "io" + "net/url" "os" "path" "strings" @@ -474,6 +475,14 @@ func shouldRetry(err error) bool { } } + // workaround for https://github.com/googleapis/google-cloud-go/issues/7090 + // seems it's a bug of golang net/http: https://github.com/golang/go/issues/53472 + if e := (&url.Error{}); goerrors.As(err, &e) { + if goerrors.Is(e.Err, io.EOF) { + return true + } + } + errMsg := err.Error() // workaround for strange unknown errors retryableErrMsg := []string{ diff --git a/br/pkg/storage/gcs_test.go b/br/pkg/storage/gcs_test.go index 95d4f50f06c10..10c456f9eeddc 100644 --- a/br/pkg/storage/gcs_test.go +++ b/br/pkg/storage/gcs_test.go @@ -574,6 +574,6 @@ func TestSpeedReadManyFiles(t *testing.T) { } func TestGCSShouldRetry(t *testing.T) { - require.True(t, shouldRetry(&url.Error{Err: goerrors.New("http2: server sent GOAWAY and closed the connectiont"), Op: "Get", URL: "https://storage.googleapis.com/storage/v1/"})) require.True(t, shouldRetry(&url.Error{Err: goerrors.New("http2: client connection lost"), Op: "Get", URL: "https://storage.googleapis.com/storage/v1/"})) + require.True(t, shouldRetry(&url.Error{Err: io.EOF, Op: "Get", URL: "https://storage.googleapis.com/storage/v1/"})) }