-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
sdk code is repeatedly calling curl_global_cleanup #2538
Comments
Hi @ButcherOfBlaviken , SDK options struct has an option to disable calling this curl method, if you prefer to call it yourself: aws-sdk-cpp/src/aws-cpp-sdk-core/include/aws/core/Aws.h Lines 90 to 94 in 0175cb2
At the same time, you are right with a proposed suggestion that we should check the flag value before attempting to Best regards, |
Testing your suggested changes |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
source file: aws-sdk-cpp-1.10.20/aws-cpp-sdk-core/source/http/curl/CurlHttpClient.cpp
Sorry my English is not very good, I hope you can understand what I mean.
For every Aws::InitAPI and Aws::ShutdownAPI pair, aws sdk calls CurlHttpClient::InitGlobalState() and CurlHttpClient::CleanupGlobalState(). In the InitGlobalState function there is a bool type flag variable isInit, because of it InitGlobalState only calls libcurl initialization API curl_global_init once, but in CleanupGlobalState function, this flag won't be unset, so CleanupGlobalState is calling libcurl cleanup API curl_global_cleanup without any restriction, according to libcurl, This function releases resources acquired by curl_global_init and application should call curl_global_cleanup once for each call you make to curl_global_init.
For my case I use both aws S3 and libcurl based https, and aws sdk code cleanup the global initialization for my libcurl based code and caused CURLE_OUT_OF_MEMORY error when I try to make a https POST.
Expected Behavior
AWS sdk shall should call [curl_global_cleanup] once for each call it makes to [curl_global_init]
Current Behavior
AWS sdk calls [curl_global_cleanup] only once but calls [curl_global_init] multi-times
Reproduction Steps
always
Possible Solution
void CurlHttpClient::CleanupGlobalState()
{
if(true==isInit)
{
curl_global_cleanup();
isInit=false;
}
}
Additional Information/Context
https://curl.se/libcurl/c/curl_global_cleanup.html
AWS CPP SDK version used
aws-sdk-cpp-1.10.20
Compiler and Version used
aarch64-linux-gnu gcc version 9.4.0
Operating System and version
aarch64-linux-gnu
The text was updated successfully, but these errors were encountered: