Skip to content

Commit 1d66764

Browse files
authored
objstore: retry on "server sent GOAWAY" http2 error (#60144) (#61938)
close #60143
1 parent d109bf0 commit 1d66764

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

br/pkg/storage/gcs.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,9 @@ func shouldRetry(err error) bool {
514514
retryableErrMsg := []string{
515515
"http2: client connection force closed via ClientConn.Close",
516516
"broken pipe",
517+
"http2: client connection lost",
518+
// See https://stackoverflow.com/questions/45209168/http2-server-sent-goaway-and-closed-the-connection-laststreamid-1999 for details.
519+
"http2: server sent GOAWAY",
517520
}
518521

519522
for _, msg := range retryableErrMsg {

br/pkg/storage/gcs_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import (
66
"bytes"
77
"context"
88
"crypto/rand"
9+
goerrors "errors"
910
"flag"
1011
"fmt"
1112
"io"
1213
"net/http"
1314
"net/http/httptest"
15+
"net/url"
1416
"os"
1517
"testing"
1618
"time"
@@ -599,3 +601,8 @@ func TestCtxUsage(t *testing.T) {
599601
// before the fix, it's context canceled error
600602
require.ErrorContains(t, err, "invalid_request")
601603
}
604+
605+
func TestGCSShouldRetry(t *testing.T) {
606+
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/"}))
607+
require.True(t, shouldRetry(&url.Error{Err: goerrors.New("http2: client connection lost"), Op: "Get", URL: "https://storage.googleapis.com/storage/v1/"}))
608+
}

0 commit comments

Comments
 (0)