Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws/request: Allows "use of closed network connection" errors to be retryable #3476

Merged
merged 2 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
### SDK Enhancements
* `codegen`: Add XXX_Values functions for getting slice of API enums by type.
* Fixes [#3441](https://github.com/aws/aws-sdk-go/issues/3441) by adding a new XXX_Values function for each API enum type that returns a slice of enum values, e.g `DomainStatus_Values`.
* `aws/request`: Update default retry to retry "use of closed network connection" errors ([#3476](https://github.com/aws/aws-sdk-go/pull/3476))
* Fixes [#3406](https://github.com/aws/aws-sdk-go/issues/3406)

### SDK Bugs
* `private/protocol/json/jsonutil`: Fixes a bug that truncated millisecond precision time in API response to seconds. ([#3474](https://github.com/aws/aws-sdk-go/pull/3474))
Expand Down
3 changes: 2 additions & 1 deletion aws/request/connection_reset_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ func isErrConnectionReset(err error) bool {
return false
}

if strings.Contains(err.Error(), "connection reset") ||
if strings.Contains(err.Error(), "use of closed network connection") ||
strings.Contains(err.Error(), "connection reset") ||
strings.Contains(err.Error(), "broken pipe") {
return true
}
Expand Down
4 changes: 4 additions & 0 deletions aws/request/connection_reset_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func TestSerializationErrConnectionReset_accept(t *testing.T) {
Err: errConnectionResetStub,
ExpectAttempts: 6,
},
"use of closed network connection": {
Err: errUseOfClosedConnectionStub,
ExpectAttempts: 6,
},
}

for name, c := range cases {
Expand Down
3 changes: 3 additions & 0 deletions aws/request/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ var (

// Generic connection reset error
errConnectionResetStub = errors.New("connection reset")

// use of closed network connection error
errUseOfClosedConnectionStub = errors.New("use of closed network connection")
)

type testData struct {
Expand Down