Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

Commented Issue: 2.3.0 : https connection leak under Linux [326]

$
0
0
Tried to upgrade from 2.2 to 2.3 with Linux 64 bits, however it appears that linux connection pool is not destroyed. I recompiled boost 1.57 and cpprest 2.3.0 with gcc 4.9 (I had to remove "-Werror" in Release/src/CMakeLists.txt) ; works fine with 2.2.0, but not with 2.3.0
How to reproduce :
- add a printf message in ~linux_connection_pool()
- with doc tutorial source code, this message is printed before program exits.
- however, after changing http://www.bing.com to https://www.bing.com and upgrading to 2.3.0, the message does not appear anymore. Moreover valgrind reports a leak.

Note that for both versions 2.2 and 2.3, valgrind emits a lot of errors regarding uninitialized memory in boost::asio ; don't know if they are real errors though.


Comments: Alright I figured out what is causing the problem. In the last release I added verification of server certificates for iOS and Android. This required setting a custom verification callback with Boost.Asio/OpenSSL (boost::asio::ssl::stream::set_verify_callback). The function object being supplied for the callback was capturing shared_ptrs back to the request context and linux_client. This unfortunately meant an extra reference was kept creating a circular reference between the connection pool and the linux_client. One solution is the break the cycle using a weak_ptr. I'm working on fix and will look perhaps at cleaning up some of this code a bit. Steve

Viewing all articles
Browse latest Browse all 4845

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>