Skip to content

Commit

Permalink
aws/request: Allows "use of closed network connection" errors to be r…
Browse files Browse the repository at this point in the history
…etryable (#3476)
  • Loading branch information
skmcgrail authored Aug 12, 2020
1 parent 0d1f059 commit 2c957a8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
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

0 comments on commit 2c957a8

Please sign in to comment.