Skip to content

Commit f6590cd

Browse files
authored
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.
1 parent 98a5598 commit f6590cd

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

storage/go110.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@
1717
package storage
1818

1919
import (
20+
"io"
2021
"net/url"
2122
"strings"
2223

2324
"google.golang.org/api/googleapi"
2425
)
2526

2627
func shouldRetry(err error) bool {
28+
if err == io.ErrUnexpectedEOF {
29+
return true
30+
}
2731
switch e := err.(type) {
2832
case *googleapi.Error:
2933
// Retry on 429 and 5xx, according to

storage/go110_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package storage
1919
import (
2020
"context"
2121
"errors"
22+
"io"
2223
"net/url"
2324
"testing"
2425

@@ -43,6 +44,7 @@ func TestInvoke(t *testing.T) {
4344
{2, &googleapi.Error{Code: 518}, nil},
4445
{2, &googleapi.Error{Code: 599}, &googleapi.Error{Code: 428}},
4546
{1, &url.Error{Op: "blah", URL: "blah", Err: errors.New("connection refused")}, nil},
47+
{1, io.ErrUnexpectedEOF, nil},
4648
} {
4749
counter := 0
4850
call := func() error {

0 commit comments

Comments
 (0)