I don't have repro steps (yet), but I noticed these leaks when running tests:
Valgrind trace:
==8878== 132 (80 direct, 52 indirect) bytes in 1 blocks are definitely lost in loss record 6,548 of 7,437 ==8878== at 0x4C2B2C0: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==8878== by 0x146CD02: mongo::WhereMatchExpression::shallowClone() const (expression_where.cpp:67) ==8878== by 0x157EC64: mongo::QueryPlannerAccess::makeCollectionScan(mongo::CanonicalQuery const&, bool, mongo::QueryPlannerParams const&) (planner_access.cpp:72) ==8878== by 0x158EF76: mongo::buildCollscanSoln(mongo::CanonicalQuery const&, bool, mongo::QueryPlannerParams const&) (query_planner.cpp:221) ==8878== by 0x15933E2: mongo::QueryPlanner::plan(mongo::CanonicalQuery const&, mongo::QueryPlannerParams const&, std::vector<mongo::QuerySolution*, std::allocator<mongo::QuerySolution*> >*) (query_planner.cpp:922) ==8878== by 0x153FA85: mongo::(anonymous namespace)::prepareExecution(mongo::OperationContext*, mongo::Collection*, mongo::WorkingSet*, mongo::CanonicalQuery*, unsigned long, mongo::PlanStage**, mongo::QuerySolution**) (get_executor.cpp:311) ==8878== by 0x15407B8: mongo::getExecutor(mongo::OperationContext*, mongo::Collection*, mongo::CanonicalQuery*, mongo::PlanExecutor::YieldPolicy, mongo::PlanExecutor**, unsigned long) (get_executor.cpp:400) ==8878== by 0x12BE6FF: mongo::CmdFindAndModify::runNoDirectClient(mongo::OperationContext*, std::string const&, mongo::BSONObj const&, mongo::BSONObj const&, mongo::BSONObj const&, bool, bool, bool, mongo::BSONObjBuilder&, std::string&) (find_and_modify.cpp:206) ==8878== by 0x12BDD6F: mongo::CmdFindAndModify::runNoDirectClient(mongo::OperationContext*, std::string const&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder&, bool) (find_and_modify.cpp:110) ==8878== by 0x12BFB8D: mongo::CmdFindAndModify::run(mongo::OperationContext*, std::string const&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder&, bool) (find_and_modify.cpp:368) ==8878== by 0x1337E26: mongo::_execCommand(mongo::OperationContext*, mongo::Command*, std::string const&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder&, bool) (dbcommands.cpp:1160) ==8878== by 0x1338DDB: mongo::Command::execCommand(mongo::OperationContext*, mongo::Command*, int, char const*, mongo::BSONObj&, mongo::BSONObjBuilder&, bool) (dbcommands.cpp:1374) ==8878== by 0x13396E8: mongo::_runCommands(mongo::OperationContext*, char const*, mongo::BSONObj&, mongo::_BufBuilder<mongo::TrivialAllocator>&, mongo::BSONObjBuilder&, bool, int) (dbcommands.cpp:1450) ==8878== by 0x1556AB8: mongo::runCommands(mongo::OperationContext*, char const*, mongo::BSONObj&, mongo::CurOp&, mongo::_BufBuilder<mongo::TrivialAllocator>&, mongo::BSONObjBuilder&, bool, int) (new_find.cpp:131) ==8878== by 0x1558745: mongo::newRunQuery(mongo::OperationContext*, mongo::Message&, mongo::QueryMessage&, mongo::CurOp&, mongo::Message&, bool) (new_find.cpp:552) ==8878== by 0x14444FA: mongo::receivedQuery(mongo::OperationContext*, mongo::Client&, mongo::DbResponse&, mongo::Message&, bool) (instance.cpp:220) ==8878== by 0x144561D: mongo::assembleResponse(mongo::OperationContext*, mongo::Message&, mongo::DbResponse&, mongo::HostAndPort const&, bool) (instance.cpp:393) ==8878== by 0x114CBCB: mongo::MyMessageHandler::process(mongo::Message&, mongo::AbstractMessagingPort*, mongo::LastError*) (db.cpp:185) ==8878== by 0x18FB872: mongo::PortMessageServer::handleIncomingMsg(void*) (message_server_port.cpp:234) ==8878== by 0x4E3F181: start_thread (pthread_create.c:312) ==8878== by 0x5D7BFBC: clone (clone.S:111) ==8878== ==8878== 161 (120 direct, 41 indirect) bytes in 1 blocks are definitely lost in loss record 6,603 of 7,437 ==8878== at 0x4C2B2C0: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==8878== by 0x157EC1B: mongo::QueryPlannerAccess::makeCollectionScan(mongo::CanonicalQuery const&, bool, mongo::QueryPlannerParams const&) (planner_access.cpp:70) ==8878== by 0x158EF76: mongo::buildCollscanSoln(mongo::CanonicalQuery const&, bool, mongo::QueryPlannerParams const&) (query_planner.cpp:221) ==8878== by 0x15933E2: mongo::QueryPlanner::plan(mongo::CanonicalQuery const&, mongo::QueryPlannerParams const&, std::vector<mongo::QuerySolution*, std::allocator<mongo::QuerySolution*> >*) (query_planner.cpp:922) ==8878== by 0x153FA85: mongo::(anonymous namespace)::prepareExecution(mongo::OperationContext*, mongo::Collection*, mongo::WorkingSet*, mongo::CanonicalQuery*, unsigned long, mongo::PlanStage**, mongo::QuerySolution**) (get_executor.cpp:311) ==8878== by 0x15407B8: mongo::getExecutor(mongo::OperationContext*, mongo::Collection*, mongo::CanonicalQuery*, mongo::PlanExecutor::YieldPolicy, mongo::PlanExecutor**, unsigned long) (get_executor.cpp:400) ==8878== by 0x12BE6FF: mongo::CmdFindAndModify::runNoDirectClient(mongo::OperationContext*, std::string const&, mongo::BSONObj const&, mongo::BSONObj const&, mongo::BSONObj const&, bool, bool, bool, mongo::BSONObjBuilder&, std::string&) (find_and_modify.cpp:206) ==8878== by 0x12BDD6F: mongo::CmdFindAndModify::runNoDirectClient(mongo::OperationContext*, std::string const&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder&, bool) (find_and_modify.cpp:110) ==8878== by 0x12BFB8D: mongo::CmdFindAndModify::run(mongo::OperationContext*, std::string const&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder&, bool) (find_and_modify.cpp:368) ==8878== by 0x1337E26: mongo::_execCommand(mongo::OperationContext*, mongo::Command*, std::string const&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder&, bool) (dbcommands.cpp:1160) ==8878== by 0x1338DDB: mongo::Command::execCommand(mongo::OperationContext*, mongo::Command*, int, char const*, mongo::BSONObj&, mongo::BSONObjBuilder&, bool) (dbcommands.cpp:1374) ==8878== by 0x13396E8: mongo::_runCommands(mongo::OperationContext*, char const*, mongo::BSONObj&, mongo::_BufBuilder<mongo::TrivialAllocator>&, mongo::BSONObjBuilder&, bool, int) (dbcommands.cpp:1450) ==8878== by 0x1556AB8: mongo::runCommands(mongo::OperationContext*, char const*, mongo::BSONObj&, mongo::CurOp&, mongo::_BufBuilder<mongo::TrivialAllocator>&, mongo::BSONObjBuilder&, bool, int) (new_find.cpp:131) ==8878== by 0x1558745: mongo::newRunQuery(mongo::OperationContext*, mongo::Message&, mongo::QueryMessage&, mongo::CurOp&, mongo::Message&, bool) (new_find.cpp:552) ==8878== by 0x14444FA: mongo::receivedQuery(mongo::OperationContext*, mongo::Client&, mongo::DbResponse&, mongo::Message&, bool) (instance.cpp:220) ==8878== by 0x144561D: mongo::assembleResponse(mongo::OperationContext*, mongo::Message&, mongo::DbResponse&, mongo::HostAndPort const&, bool) (instance.cpp:393) ==8878== by 0x114CBCB: mongo::MyMessageHandler::process(mongo::Message&, mongo::AbstractMessagingPort*, mongo::LastError*) (db.cpp:185) ==8878== by 0x18FB872: mongo::PortMessageServer::handleIncomingMsg(void*) (message_server_port.cpp:234) ==8878== by 0x4E3F181: start_thread (pthread_create.c:312) ==8878== by 0x5D7BFBC: clone (clone.S:111)
david.storch / rassi@10gen.com: Is this enough info to diagnose the leak(s)?
Version: 491a9728d381
- duplicates
-
SERVER-19040 WhereMatchExpression::shallowClone can leak memory during interruption
- Closed
- is related to
-
SERVER-16889 Query subsystem public API should use std::unique_ptr for ownership transfer
- Closed