From f6590cdc26c8479be5df48949fa59f879e0c24fc Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Mon, 19 Apr 2021 15:13:24 -0400 Subject: [PATCH] fix(storage): retry io.ErrUnexpectedEOF (#3957) This error can be caused by network flakiness. We already retry it in the apiary client logic for uploads, so we should retry here as well. --- storage/go110.go | 4 ++++ storage/go110_test.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/storage/go110.go b/storage/go110.go index c1273d59ade..804d39fa936 100644 --- a/storage/go110.go +++ b/storage/go110.go @@ -17,6 +17,7 @@ package storage import ( + "io" "net/url" "strings" @@ -24,6 +25,9 @@ import ( ) func shouldRetry(err error) bool { + if err == io.ErrUnexpectedEOF { + return true + } switch e := err.(type) { case *googleapi.Error: // Retry on 429 and 5xx, according to diff --git a/storage/go110_test.go b/storage/go110_test.go index f1cf9bb1062..9439bb6006d 100644 --- a/storage/go110_test.go +++ b/storage/go110_test.go @@ -19,6 +19,7 @@ package storage import ( "context" "errors" + "io" "net/url" "testing" @@ -43,6 +44,7 @@ func TestInvoke(t *testing.T) { {2, &googleapi.Error{Code: 518}, nil}, {2, &googleapi.Error{Code: 599}, &googleapi.Error{Code: 428}}, {1, &url.Error{Op: "blah", URL: "blah", Err: errors.New("connection refused")}, nil}, + {1, io.ErrUnexpectedEOF, nil}, } { counter := 0 call := func() error {