Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We upload large amount of data to s3 and after upgrading version 1.0.0 , we experienced failures for large uploads , randomly we get errors like below.
RequestError: send request failed caused by: Put "https://testing.s3.amazonaws.com/xxxxx&partNumber=n&uploadId=id": write tcp 10.xx.xx.xx:41654->52.216.8.115:443: use of closed network connection
After digging AWS SDK
ShouldRetry
method, we noticed that for some cases it does returnfalse
but for some cases it returnstrue
even if base error saysuse of closed network connection
in both cases, you can see belowSerializationError: failed to unmarshal error message status code: 500, request id: IDDDDDDD, host id: 3231sdsadasdasdI= caused by: UnmarshalError: failed to unmarshal error message caused by: read tcp 10.xx.xx.xx:39860->52.216.166.67:443: use of closed network connection: true
RequestError: send request failed caused by: Put "https://testing.s3.amazonaws.com/xxxx?partNumber=n&uploadId=id--": write tcp 10.xx.xx.xx:41654->52.216.8.115:443: use of closed network connection: false
So we implemented this patch to retry on any error that contains
use of closed network connection
, as golang does not export this errorhttps://github.com/golang/go/issues/4373
, we had to check error msg.