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

Memory leak in s3manager.newPartPool #3035

Closed
michele opened this issue Dec 20, 2019 · 0 comments · Fixed by #3069
Closed

Memory leak in s3manager.newPartPool #3035

michele opened this issue Dec 20, 2019 · 0 comments · Fixed by #3069

Comments

@michele
Copy link

michele commented Dec 20, 2019

Please fill out the sections below to help us address your issue.

Version of AWS SDK for Go?

v1.25.48

Version of Go (go version)?

1.13

What issue did you see?

We recently started uploading some files to S3 and noticed we started leaking like crazy. After running pprof, we noticed 97% of the heap is consumed by github.com/aws/aws-sdk-go/service/s3/s3manager.newPartPool.func1

Steps to reproduce

This is the function we're using to serialize a bunch of objects and upload it to S3:

func (s S3Store) Upload(obj Object) error {
        uploader := s3manager.NewUploaderWithClient(s.svc)
        bts, err := json.Marshal(obj)
        if err != nil {
                return errors.Wrap(err, "S3Store#Upload: couldn't marshal object")
        }
        buf := bytes.NewBuffer(bts)
        params := &s3manager.UploadInput{
                Bucket:      aws.String(s.Bucket),
                Key:         aws.String(obj.Filename()),
                Body:        buf,
                ContentType: aws.String("application/json"),
        }
        _, err = uploader.Upload(params)
        if err != nil {
                return errors.Wrap(err, fmt.Sprintf("couldn't upload file to S3: s3://%s/%s", *params.Bucket, *params.Key))
        }
        return nil
}

s.svc is what's returned by s3.New. When uploading a few thousands objects it can easily eat through 100s of MB of RAM.

aws-sdk-go-automation pushed a commit that referenced this issue Jan 10, 2020
===

### Service Client Updates
* `service/chime`: Updates service API and documentation
  * Add shared profile support to new and existing users
* `service/ec2`: Updates service API and documentation
  * This release introduces the ability to tag egress only internet gateways, local gateways, local gateway route tables, local gateway virtual interfaces, local gateway virtual interface groups, local gateway route table VPC association and local gateway route table virtual interface group association. You can use tags to organize and identify your resources for cost allocation.
* `service/rds`: Updates service API and documentation
  * This release adds an operation that enables users to override the system-default SSL/TLS certificate for new Amazon RDS DB instances temporarily, or remove the customer override.
* `service/sagemaker`: Updates service API and documentation
  * SageMaker ListTrialComponents API filter by TrialName and ExperimentName.
* `service/transfer`: Updates service API and documentation
  * This release introduces a new endpoint type that allows you to attach Elastic IP addresses from your AWS account with your server's endpoint directly and whitelist access to your server by client's internet IP address(es) using VPC Security Groups.
* `service/workspaces`: Updates service API and documentation
  * Added the migrate feature to Amazon WorkSpaces.

### SDK Features
* Add generated error types for JSONRPC and RESTJSON APIs
  * Adds generated error types for APIs using JSONRPC and RESTJSON protocols. This allows you to retrieve additional error metadata within an error message that was previously unavailable. For example, Amazon DynamoDB's TransactWriteItems operation can return a `TransactionCanceledException` continuing detailed `CancellationReasons` member. This data is now available by type asserting the error returned from the operation call to `TransactionCanceledException` type.
* `service/dynamodb/dynamodbattribute`: Go 1.9+, Add caching of struct serialization ([#3070](#3070))
  * For Go 1.9 and above, adds struct field caching to the SDK's DynamoDB AttributeValue marshalers and unmarshalers. This significantly reduces time, and overall allocations of the (un)marshalers by caching the reflected structure's fields. This should improve the performance of applications using DynamoDB AttributeValue (un)marshalers.

### SDK Bugs
* `service/s3/s3manager`: Fix resource leak on failed CreateMultipartUpload calls ([#3069](#3069))
  * Fixes [#3000](#3000), [#3035](#3035)
aws-sdk-go-automation added a commit that referenced this issue Jan 10, 2020
Release v1.28.0 (2020-01-10)
===

### Service Client Updates
* `service/chime`: Updates service API and documentation
  * Add shared profile support to new and existing users
* `service/ec2`: Updates service API and documentation
  * This release introduces the ability to tag egress only internet gateways, local gateways, local gateway route tables, local gateway virtual interfaces, local gateway virtual interface groups, local gateway route table VPC association and local gateway route table virtual interface group association. You can use tags to organize and identify your resources for cost allocation.
* `service/rds`: Updates service API and documentation
  * This release adds an operation that enables users to override the system-default SSL/TLS certificate for new Amazon RDS DB instances temporarily, or remove the customer override.
* `service/sagemaker`: Updates service API and documentation
  * SageMaker ListTrialComponents API filter by TrialName and ExperimentName.
* `service/transfer`: Updates service API and documentation
  * This release introduces a new endpoint type that allows you to attach Elastic IP addresses from your AWS account with your server's endpoint directly and whitelist access to your server by client's internet IP address(es) using VPC Security Groups.
* `service/workspaces`: Updates service API and documentation
  * Added the migrate feature to Amazon WorkSpaces.

### SDK Features
* Add generated error types for JSONRPC and RESTJSON APIs
  * Adds generated error types for APIs using JSONRPC and RESTJSON protocols. This allows you to retrieve additional error metadata within an error message that was previously unavailable. For example, Amazon DynamoDB's TransactWriteItems operation can return a `TransactionCanceledException` continuing detailed `CancellationReasons` member. This data is now available by type asserting the error returned from the operation call to `TransactionCanceledException` type.
* `service/dynamodb/dynamodbattribute`: Go 1.9+, Add caching of struct serialization ([#3070](#3070))
  * For Go 1.9 and above, adds struct field caching to the SDK's DynamoDB AttributeValue marshalers and unmarshalers. This significantly reduces time, and overall allocations of the (un)marshalers by caching the reflected structure's fields. This should improve the performance of applications using DynamoDB AttributeValue (un)marshalers.

### SDK Bugs
* `service/s3/s3manager`: Fix resource leak on failed CreateMultipartUpload calls ([#3069](#3069))
  * Fixes [#3000](#3000), [#3035](#3035)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant