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

10M memory leave after ShutdownAPI called for 1000 client created #2950

Closed
imchenkai opened this issue May 9, 2024 · 1 comment
Closed
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@imchenkai
Copy link

imchenkai commented May 9, 2024

Describe the bug

We use awsclient in multi threaded environment, The program will continuously generate and destroy awsclient instances。Found that may use alot of memory in this program and never release after showdownAPI called, Is this the expected behavior of awssdk?

Expected Behavior

should release memory after Aws::S3::S3Client deleted,or ShutdownAPI ?

Current Behavior

10M memory leave after ShutdownAPI called for 1000 client created

Reproduction Steps

this is code simple

int main()
{
    Aws::SDKOptions options;
    Aws::InitAPI(options);
    std::thread threads[16];
    int i;
    for (i = 0; i < 16; i++) {
        threads[i] = std::thread([i]() {
            int times = 0;
            while (times  < 100)  {
                std::cout << "run:" << times++  << std::endl;
                Aws::Client::ClientConfiguration config;
                config.endpointOverride = "[172.16.0.95:9000](http://172.16.0.95:9000/)";
                config.verifySSL = true;
                config.scheme = Aws::Http::Scheme::HTTP;
                config.requestTimeoutMs = 100;
                config.connectTimeoutMs = 100;
                Aws::Auth::AWSCredentials cred("minioadmin", "minioadmin");
                Aws::S3::S3Client s3_client(cred, config, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never,
                                    false);
                Aws::S3::Model::ListObjectsRequest request;
                request.WithBucket("link"); 
                auto outcome = s3_client.ListObjects(request);

                if (outcome.IsSuccess())
                {
                    const Aws::Vector<Aws::S3::Model::Object>& objects = outcome.GetResult().GetContents();

                    if (!objects.empty())
                    {
                        const Aws::S3::Model::Object& first_object = objects[0];
                        Aws::S3::Model::GetObjectRequest get_request;
                        get_request.WithBucket("link") 
                                .WithKey(first_object.GetKey());
                    }
                }
            }
        });
    }

    for (i = 0; i < 16; ++i)
    {
        threads[i].join();
    }
    Aws::ShutdownAPI(options);
    return 0;
}

Possible Solution

No response

Additional Information/Context

No response

AWS CPP SDK version used

1.11.323

Compiler and Version used

9.3.1

Operating System and version

centos7

@imchenkai imchenkai added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 9, 2024
@imchenkai imchenkai closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
Copy link

github-actions bot commented May 9, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

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. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant