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

[DynamoDB] RequestError: send request failed #5037

Closed
lsimunec opened this issue Oct 25, 2023 · 4 comments
Closed

[DynamoDB] RequestError: send request failed #5037

lsimunec opened this issue Oct 25, 2023 · 4 comments
Assignees
Labels
bug This issue is a bug. closed-for-staleness p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@lsimunec
Copy link

lsimunec commented Oct 25, 2023

Describe the bug

On random occasions we receive connection reset by peer when querying Dynamo database.

The error message "connection reset by peer" typically occurs in network-related communication, and it often indicates that the connection between two systems has been unexpectedly closed by the remote end, which, in this case, is the DynamoDB service.

Expected Behavior

Expected to not happen or at least be handled by dynamodb.ErrCodeInternalServerError.
If already handled by some error, please document in which one.

Current Behavior

RequestError: send request failed
caused by: Post "https://dynamodb.eu-central-1.amazonaws.com/": read tcp 100.117.202.148:56260->35.71.105.0:443: read: connection reset by peer

Reproduction Steps

Cannot reproduce, appears to be random on all types of queries.

Example
output, err := e.client.QueryWithContext(ctx, input)

Possible Solution

No response

Additional Information/Context

No response

SDK version used

v1.45.11

Environment details (Version of Go (go version)? OS name and version, etc.)

Go 1.20 and Go 1.21

@lsimunec lsimunec added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 25, 2023
@RanVaknin
Copy link
Contributor

Hi @MikaelSmith,

Expected to not happen or at least be handled by dynamodb.ErrCodeInternalServerError.

The error you're seeing originates directly from the networking layer. This occurs before the request has made a full round trip to and from the DynamoDB service, disrupting the process before a response is received.
Because of this disruption, the SDK doesn't have service data required to deserialize it into a service-specific, concrete error, like dynamodb.ErrCodeInternalServerError.

Instead, a common strategy of http clients is to retry on transient error (connection reset, connection timeout etc). The Go SDK is already equipped to deal with this specific error in a form of retry. connection reset error.

Since this is not reproducible, caused by networking stack, and we have a mitigation strategy (retry) this is not actionable by the Go SDK team. You can enable logging to make sure that retries are taking effect.

If you have any other questions please let us know.

Thanks,
Ran~

@RanVaknin RanVaknin self-assigned this Oct 25, 2023
@RanVaknin RanVaknin added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p3 This is a minor priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Oct 25, 2023
@github-actions
Copy link

This issue has not received a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Oct 28, 2023
@github-actions github-actions bot closed this as completed Nov 2, 2023
@wojtekwanczyk
Copy link

Refreshing the issue as I see the same read: connection reset by peer error not being retried by DynamoDB.

I checked the function referenced by @RanVaknin and it seems that this specific error string (read: connection reset) is excluded from being Connection Reset Error in this commit by @jasdel. Why is this excluded from retry process?

SDK version used

v1.42.25

Environment details (Version of Go (go version)? OS name and version, etc.)

Go 1.21

@bensie
Copy link

bensie commented May 16, 2024

@wojtekwanczyk Been seeing this issue as well. While it's not particularly well-documented in that commit, a read: connection reset here means that the request was already handled by the server and is being interrupted on the way back to the client. Since this could have been a write request (PutItem, etc), it's not inherently safe to retry. It should be safe to retry in Query or GetItem requests, but since this is configured at the client level and not the operation level, the default needs to assume it's unsafe for retry.

aws-sdk-go-v2 supports modifying the retryer per-operation:

	getItemOutput, err := DynamoDB.GetItem(ctx, input, func(o *dynamodb.Options) {
		o.Retryer = ...
	})

Haven't found a way to do this yet in v1 - @RanVaknin can you speak to whether or not that's possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closed-for-staleness p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

4 participants