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

S3Client Uploading Leaks Memory on Windows caused by InitializeSecurityContext misuse #3021

Closed
normanade opened this issue Jul 1, 2024 · 4 comments
Labels
bug This issue is a bug. p2 This is a standard priority issue pending-release This issue will be fixed by an approved PR that hasn't been released yet.

Comments

@normanade
Copy link
Contributor

Describe the bug

Aws::S3::S3Client::PutObject leaks memory on Windows. Static funtion s_handler_shutdown in crt/aws-crt-cpp/crt/aws-c-io/source/windows/secure_channel_tls_handler.c is called during uploading, downloading, listing, deleting, any move related to a network request. However, after calling InitializeSecurityContext, current version of code has failed to call the corresponding memory release function FreeContextBuffer.

Expected Behavior

Upload, download, list, delete files normally and don't leak memory.

Current Behavior

Memory usage increases by 200KiB per 1k call.

Reproduction Steps

Call Aws::S3::S3Client::PutObject 1k times.

Possible Solution

In crt/aws-crt-cpp/crt/aws-c-io/source/windows/secure_channel_tls_handler.c, fix the static function s_handler_shutdown by adding FreeContextBuffer correctly.

Additional Information/Context

No response

AWS CPP SDK version used

1.11.314

Compiler and Version used

Visual Studio 2022

Operating System and version

Windows 10

@normanade normanade added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 1, 2024
@jmklix
Copy link
Member

jmklix commented Jul 1, 2024

Thanks for opening this PR. We are currently reviewing it.

@jmklix jmklix added pending-release This issue will be fixed by an approved PR that hasn't been released yet. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Jul 1, 2024
@jmklix
Copy link
Member

jmklix commented Jul 8, 2024

Updated PR: awslabs/aws-c-io#652

@jmklix
Copy link
Member

jmklix commented Jul 10, 2024

Merged: awslabs/aws-c-io#652
Please wait for the release to get published and let us know if you have any other issues while using this sdk.

@jmklix jmklix closed this as completed Jul 10, 2024
Copy link

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. p2 This is a standard priority issue pending-release This issue will be fixed by an approved PR that hasn't been released yet.
Projects
None yet
Development

No branches or pull requests

2 participants