Large leak for each request
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical System Image |
Fix Released
|
High
|
Unassigned | ||
net-cpp |
Fix Released
|
Critical
|
Thomas Voß | ||
net-cpp (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
When I run the http_client_test under valgrind, I'm seeing a large leak for each request. After the 11 request made by the test, valgrind reports that 2.7 MB of memory have gone missing. Note that this appears to be a different leak than the one in bug #1419620.
Excerpt from valgrind:
==6870== 2,014 (72 direct, 1,942 indirect) bytes in 1 blocks are definitely lost in loss record 129 of 143
==6870== at 0x4C2CC90: calloc (in /usr/lib/
==6870== by 0x6267E96: curl_share_init (in /usr/lib/
==6870== by 0x4EA0614: curl::shared:
==6870== by 0x4EA05B5: curl::shared:
==6870== by 0x4E80E35: curl::easy:
==6870== by 0x4E7F501: curl::easy:
==6870== by 0x4E4E1A5: core::net:
==6870== by 0x43CDDD: HttpClient_
==6870== by 0x47D111: void testing:
==6870== by 0x47852C: void testing:
==6870== by 0x45F3C0: testing:
==6870== by 0x45FBCA: testing:
==6870==
==6870== 2,748,793 (17,920 direct, 2,730,873 indirect) bytes in 35 blocks are definitely lost in loss record 143 of 143
==6870== at 0x4C2B100: operator new(unsigned long) (in /usr/lib/
==6870== by 0x4E833FA: curl::multi:
==6870== by 0x4E4D5A8: core::net:
==6870== by 0x4E771EB: _ZN9__gnu_
==6870== by 0x4E71DDA: _ZNSt16allocato
==6870== by 0x4E6DCDE: _ZNSt16allocato
==6870== by 0x4E6A7BD: std::_Sp_
==6870== by 0x4E66C9B: _ZN9__gnu_
==6870== by 0x4E637BD: _ZNSt16allocato
==6870== by 0x4E60CC1: _ZNSt16allocato
==6870== by 0x4E5DDA2: std::__
==6870== by 0x4E599AB: std::__
==6870==
==6870== LEAK SUMMARY:
==6870== definitely lost: 18,640 bytes in 45 blocks
==6870== indirectly lost: 2,750,293 bytes in 36,500 blocks
==6870== possibly lost: 0 bytes in 0 blocks
==6870== still reachable: 64 bytes in 2 blocks
==6870== suppressed: 0 bytes in 0 blocks
==6870== Reachable blocks (those to which a pointer was found) are not shown.
==6870== To see them, rerun with: --leak-check=full --show-
==6870==
==6870== For counts of detected and suppressed errors, rerun with: -v
==6870== ERROR SUMMARY: 11 errors from 11 contexts (suppressed: 0 from 0)
Related branches
- Michi Henning (community): Approve
- PS Jenkins bot: Needs Fixing (continuous-integration)
-
Diff: 484 lines (+149/-91)4 files modifieddebian/control (+0/-1)
src/core/net/http/impl/curl/easy.cpp (+19/-9)
src/core/net/http/impl/curl/easy.h (+38/-12)
src/core/net/http/impl/curl/multi.cpp (+92/-69)
Changed in net-cpp: | |
importance: | Undecided → Critical |
status: | New → In Progress |
assignee: | nobody → Thomas Voß (thomas-voss) |
Changed in canonical-devices-system-image: | |
status: | In Progress → Fix Released |
Changed in net-cpp: | |
status: | In Progress → Fix Released |
With the MP attached to this bug, the leaks are gone, except for a spurious one on shutdown that can be attributed to CURL. Quoting from the original MP discussion here:
Running the load test in a loop, after maybe a hundred iterations or so, I got a valgrind complaint:
==29504== valgrind/ vgpreload_ memcheck- amd64-linux. so) asio::detail: :thread_ info_base: :allocate( boost:: asio::detail: :thread_ info_base* , unsigned long) (thread_ info_base. hpp:60) asio::asio_ handler_ allocate( unsigned long, ...) (handler_ alloc_hook. ipp:50) handler_ alloc_helpers: :allocate< curl::multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&) #1}>(unsigned long, curl::multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&)#1}&) (handler_ alloc_helpers. hpp:37) asio::detail: :deadline_ timer_service< boost:: asio::time_ traits< boost:: posix_time: :ptime> >::async_ wait<curl: :multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&) #1}>(boost: :asio:: detail: :deadline_ timer_service< boost:: asio::time_ traits< boost:: posix_time: :ptime> >::implementati on_type& , curl::multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&)#1}&) (deadline_ timer_service. hpp:185) asio::async_ result< boost:: asio::handler_ type<curl: :multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&)#1}, void (boost: :system: :error_ code)>: :type>: :type boost:: asio::deadline_ timer_service< boost:: posix_time: :ptime, boost:: asio::time_ traits< boost:: posix_time: :ptime> >::async_ wait<curl: :multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&) #1}>(boost: :asio:: detail: :deadline_ timer_service< boost:: asio::time_ traits< boost:: posix_time: :ptime> >::implementati on_type& , boost:: asio::handler_ type&&) (deadline_ timer_service. hpp:149) asio::async_ result< boost:: asio::handler_ type<curl: :mult.. .
==29504== HEAP SUMMARY:
==29504== in use at exit: 161,360 bytes in 1,769 blocks
==29504== total heap usage: 325,601 allocs, 323,832 frees, 54,917,164 bytes allocated
==29504==
==29504== 161,296 (73 direct, 161,223 indirect) bytes in 1 blocks are definitely lost in loss record 64 of 64
==29504== at 0x4C2B100: operator new(unsigned long) (in /usr/lib/
==29504== by 0x4E8A699: boost::
==29504== by 0x4E8A7A8: boost::
==29504== by 0x4E883DE: void* boost_asio_
==29504== by 0x4E87F56: void boost::
==29504== by 0x4E87CA1: boost::
==29504== by 0x4E87B93: boost::