Open ksasik opened 2 years ago
We recommend using libcurl for new projects.
However, more information about the leak would be appreciated. How are you detecting the leak? Can you generate a callstack for the leaking allocations?
Hi @barcharcraz , our project is using openapi generator + cpprestsdk. https://openapi-generator.tech/docs/generators/cpp-restsdk
But libcurl is not a client generator that is supported by openapi. https://openapi-generator.tech/docs/generators
Which client generator would you suggest to use?
We recommend using libcurl for new projects.
However, more information about the leak would be appreciated. How are you detecting the leak? Can you generate a callstack for the leaking allocations?
Hi @barcharcraz,
Here is the sample code:
memory leak is detected using valgrind tool. Here is the leak call stack:
@barcharcraz When you say "we recommend using libcurl in projects", Do you mean use libcurl instead of libcrypto?
Hi, any feedback on this issue? Facing the same problem.
Hi
I am facing a similar issue, at least in terms of consequences (memory leak)
Here is the sample code to reproduce what I am trying to do (a https client request with certificate verification disabled)
#include <cpprest/http_client.h>
int main() {
web::http::client::http_client_config lConfig;
lConfig.set_validate_certificates(false);
std::string lUrl = "https://google.com";
web::http::client::http_client lHttpClient(lUrl, lConfig);
web::http::http_request lGetRequest(web::http::methods::GET);
try {
lHttpClient.request(lGetRequest)
.then([](const web::http::http_response &response) {
if (response.status_code() == web::http::status_codes::OK) {
std::cout << "OK" << std::endl;
}
})
.wait();
} catch (const std::exception &e) {
std::cerr << e.what() << std::endl;
}
return 0;
}
In the environment I am working on the following versions are used: openssl-1.1.1b boost v1.65.0 cpprestsdk v2.10.16
I recompiled these 3 libraries with debug info to get more detailled backtraces with valgrind but I'm having troubles to analyze where it all comes from valgrind-logs.txt
The same code for a HTTP request does not report any leak.
I have also tried to upgrade the 3 libraries involved but without success (openssl-1.1.1t boost v1.84.0 cpprestsdk v2.10.19)
What do you thing of all this ? I have been wondering if there needs to be an extra call to cleanup the SSL environment (calling directly openssl functions) but I failed to reach a solution
Thanks
When implementing restapi using cpprest with https schema, memory leak is observed which is pointing to CRYPTO libraries api call i.e CRYPTO_zalloc. If used with http schema, there is no memory leak observed.
Any help is highly appreciated...Thank you in advance.