Memory leak in http-client module

Bug #950456 reported by Paul J. Lucas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Released
High
Paul J. Lucas

Bug Description

The original output from valgrind:

==7222== at 0x4C274A8: malloc (vg_replace_malloc.c:236)
==7222== by 0xC136F21: ???
==7222== by 0xC1964AE: ???
==7222== by 0xC1878D4: ???
==7222== by 0xC1881D1: ???
==7222== by 0xC18BB9E: ???
==7222== by 0xC189D62: ???
==7222== by 0xB392D98: ???
==7222== by 0xB39BCF8: ???
==7222== by 0xB39BD37: ???
==7222== by 0xB162548: ???
==7222== by 0xB162C98: ???
==7222== by 0x58B0700: zorba::ExtFunctionCallIterator::nextImpl(zorba::store::ItemHandle<zorba::store::Item>&, zorba::PlanState&) const (fncall_iterator.cpp:787)
==7222== by 0x5846103: zorba::PlanIterator::consumeNext(zorba::store::ItemHandle<zorba::store::Item>&, zorba::PlanIterator const*, zorba::PlanState&) (plan_iterator.cpp:124)
==7222== by 0x58DD68E: zorba::TreatIterator::nextImpl(zorba::store::ItemHandle<zorba::store::Item>&, zorba::PlanState&) const (sequencetypes.cpp:513)
==7222== by 0x5846103: zorba::PlanIterator::consumeNext(zorba::store::ItemHandle<zorba::store::Item>&, zorba::PlanIterator const*, zorba::PlanState&) (plan_iterator.cpp:124)
==7222== by 0x5F98818: zorba::simplestore::SimpleTempSeq::init(zorba::rchandle<zorba::store::Iterator> const&) (simple_temp_seq.cpp:81)
==7222== by 0x5F6C555: zorba::simplestore::SimpleStore::createTempSeq(zorba::rchandle<zorba::store::Iterator> const&, bool) (simple_temp_seq.h:59)
==7222== by 0x5375BB9: zorba::dynamic_context::set_variable(unsigned long, zorba::store::ItemHandle<zorba::store::Item> const&, zorba::QueryLoc const&, zorba::rchandle<zorba::store::Iterator>&) (dynamic_context.cpp:316)
==7222== by 0x58FA66F: zorba::CtxVarDeclareIterator::nextImpl(zorba::store::ItemHandle<zo

Related branches

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

Using the following command:

LD_PRELOAD=./LIB_PATH/com/zorba-xquery/www/modules/libhttp-client_2.0.so valgrind --leak-check=full bin/zorba -f -i -r --trailing-nl -q ../test/rbkt/Queries/zorba/http-client/put/put2_integer.xq

produce more useful output:

==32761== HEAP SUMMARY:
==32761== in use at exit: 35,781 bytes in 2,408 blocks
==32761== total heap usage: 86,079 allocs, 83,671 frees, 10,166,929 bytes allocated
==32761==
==32761== 705 (180 direct, 525 indirect) bytes in 1 blocks are definitely lost in loss record 438 of 447
==32761== at 0x402641D: operator new(unsigned int) (vg_replace_malloc.c:255)
==32761== by 0x4048108: zorba::http_client::HttpRequestHandler::beginBody(zorba::String, zorba::String, zorba::ItemSequence*) (http_request_handler.cpp:170)
==32761== by 0x403F2D6: zorba::http_client::RequestParser::handleBody(zorba::Item const&) (request_parser.cpp:213)
==32761== by 0x403E1CD: zorba::http_client::RequestParser::parseItem(zorba::Item const&) (request_parser.cpp:74)
==32761== by 0x403E88A: zorba::http_client::RequestParser::handleRequest(zorba::Item const&) (request_parser.cpp:130)
==32761== by 0x403E0B8: zorba::http_client::RequestParser::parseItem(zorba::Item const&) (request_parser.cpp:66)
==32761== by 0x403E009: zorba::http_client::RequestParser::parse(zorba::Item const&) (request_parser.cpp:53)
==32761== by 0x404A904: zorba::http_client::general_evaluate(std::vector<zorba::ItemSequence*, std::allocator<zorba::ItemSequence*> > const&, zorba::StaticContext const*, zorba::DynamicContext const*, zorba::ItemFactory*) (http_client.cpp:191)
==32761== by 0x404AD88: zorba::http_client::HttpSendFunction::evaluate(std::vector<zorba::ItemSequence*, std::allocator<zorba::ItemSequence*> > const&, zorba::StaticContext const*, zorba::DynamicContext const*) const (http_client.cpp:233)
==32761== by 0x4D8D4FD: zorba::ExtFunctionCallIterator::nextImpl(zorba::store::ItemHandle<zorba::store::Item>&, zorba::PlanState&) const (fncall_iterator.cpp:788)
==32761== by 0x4D952DE: zorba::Batcher<zorba::ExtFunctionCallIterator>::produceNext(zorba::store::ItemHandle<zorba::store::Item>&, zorba::PlanState&) const (plan_iterator.h:531)
==32761== by 0x4D179E6: zorba::PlanIterator::consumeNext(zorba::store::ItemHandle<zorba::store::Item>&, zorba::PlanIterator const*, zorba::PlanState&) (plan_iterator.cpp:124)
==32761==
==32761== LEAK SUMMARY:
==32761== definitely lost: 180 bytes in 1 blocks
==32761== indirectly lost: 525 bytes in 1 blocks
==32761== possibly lost: 0 bytes in 0 blocks
==32761== still reachable: 35,076 bytes in 2,406 blocks
==32761== suppressed: 0 bytes in 0 blocks
==32761== Reachable blocks (those to which a pointer was found) are not shown.
==32761== To see them, rerun with: --leak-check=full --show-reachable=yes

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

Fixed by adding:

delete theSerStream;

at line 61 in http_request_handler.cpp.

Changed in zorba:
status: New → In Progress
Changed in zorba:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.