Skip to content

DynamoDB returns operation error use of closed network (relates to issue #1825) #2935

Closed as not planned
@katesclau

Description

@katesclau

Acknowledgements

Describe the bug

SDK often returns the error below

operation error DynamoDB: Query, https response error StatusCode: 200, RequestID: E8GNL8TL9KAI5LAERRM784GLBJVV4KQNSO5AEMVJF66Q9ASUAAJG, deserialization failed, failed to decode response body, read tcp 10.204.XX.XXX:38876->35.71.XX.XXX:443: use of closed network connection

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

No errors

Current Behavior

operation error DynamoDB: Query, https response error StatusCode: 200, RequestID: E8GNL8TL9KAI5LAERRM784GLBJVV4KQNSO5AEMVJF66Q9ASUAAJG, deserialization failed, failed to decode response body, read tcp 10.204.XX.XXX:38876->35.71.XX.XXX:443: use of closed network connection

Reproduction Steps

	ddb := dynamodb.NewFromConfig(awsCfg, func(o *dynamodb.Options) {
		client := o.HTTPClient.(*awshttp.BuildableClient)
		o.HTTPClient = client.WithTransportOptions(func(t *http.Transport) {
			t.DialContext = trace.TraceConn(t.DialContext)
		})
	})
	item, err := ddb.GetItem(ctx, &dynamodb.GetItemInput{
		TableName: "test-table-name",
		Key: map[string]types.AttributeValue{
			lstAttrID: &types.AttributeValueMemberS{Value: id},
		},
	})
	if err != nil {
		return nil, err
	}

Possible Solution

No response

Additional Information/Context

Additional Information/Context

As requested on Issue #1825 , we've implemented a TracedConnection to evaluate the stack trace on the connection close event, following these instructions:

goroutine 52154 [running]:
runtime/debug.Stack()
\t/usr/local/go/src/runtime/debug/stack.go:26 +0x5e
github.com/.../helpers/trace.(*TracedConn).Close(0xc001fde9e0)
\t/tmp/source/vendor/github.com/.../helpers/trace/tracedconnection.go:43 +0x18
crypto/tls.(*Conn).Close(0xc00018a010?)
\t/usr/local/go/src/crypto/tls/conn.go:1444 +0xc8
net/http.(*persistConn).closeLocked(0xc0001ea480, {0x19e6a00, 0x2400680})
\t/usr/local/go/src/net/http/transport.go:2848 +0x13a
net/http.(*persistConn).close(0xc0001e0d80?, {0x19e6a00?, 0x2400680?})
\t/usr/local/go/src/net/http/transport.go:2833 +0xa5
net/http.(*persistConn).closeConnIfStillIdle(0xc0001ea480)
\t/usr/local/go/src/net/http/transport.go:2103 +0xbd
created by time.goFunc
\t/usr/local/go/src/time/sleep.go:215 +0x2d

AWS Go SDK V2 Module Versions Used

	github.com/aws/aws-sdk-go-v2 v1.32.6
	github.com/aws/aws-sdk-go-v2/config v1.28.6
	github.com/aws/aws-sdk-go-v2/credentials v1.17.47
	github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.15.21
	github.com/aws/aws-sdk-go-v2/feature/dynamodb/expression v1.7.56
	github.com/aws/aws-sdk-go-v2/service/dynamodb v1.38.0
	github.com/aws/aws-sdk-go-v2/service/s3 v1.71.0
	github.com/aws/aws-sdk-go-v2/service/sqs v1.37.2

Compiler and Version used

go 1.23.0

Operating System and version

Linux (alpine:latest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions