Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-25581

Leaked ParsedAddField when destructing DocumentSource for $addFields stage

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.3.11
    • Fix Version/s: 3.3.12
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Compile and run the document_source_test C++ unit test under ASan.

      Output

      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.238+0000 =================================================================
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.238+0000 ==26605==ERROR: LeakSanitizer: detected memory leaks
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.238+0000 
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.238+0000 Direct leak of 168 byte(s) in 1 object(s) allocated from:
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.238+0000     #0 0x56294beb1770 in operator new(unsigned long) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x648770)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.239+0000     #1 0x56294c9de860 in mongo::parsed_aggregation_projection::ParsedAddFields::ParsedAddFields() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x1175860)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.239+0000     #2 0x56294c9d832f in mongo::parsed_aggregation_projection::ParsedAddFields::create(mongo::BSONObj const&) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x116f32f)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.240+0000     #3 0x56294c6c1b39 in mongo::DocumentSourceAddFields::createFromBson(mongo::BSONElement, boost::intrusive_ptr<mongo::ExpressionContext> const&) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0xe58b39)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.240+0000     #4 0x56294c07bde9 in DocumentSourceTests::DocumentSourceAddFields::AddFieldsTest::createAddFields(mongo::BSONObj const&) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x812de9)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.240+0000     #5 0x56294c00ce18 in DocumentSourceTests::DocumentSourceAddFields::UnitTest__AddFieldsTest__OptimizesInnerExpressions::_doTest() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x7a3e18)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.241+0000     #6 0x56294cd8b604 in mongo::unittest::Test::run() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x1522604)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.241+0000     #7 0x56294c09bc87 in void mongo::unittest::Suite::runTestObject<DocumentSourceTests::DocumentSourceAddFields::UnitTest__AddFieldsTest__OptimizesInnerExpressions>() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x832c87)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.241+0000     #8 0x56294cd8e987 in mongo::unittest::Suite::run(std::string const&, int) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x1525987)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.242+0000     #9 0x56294cd9240d in mongo::unittest::Suite::run(std::vector<std::string, std::allocator<std::string> > const&, std::string const&, int) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x152940d)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.242+0000     #10 0x56294cd9c91b in main (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x153391b)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.242+0000     #11 0x7f65f36e782f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.242+0000 
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.242+0000 Direct leak of 168 byte(s) in 1 object(s) allocated from:
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.243+0000     #0 0x56294beb1770 in operator new(unsigned long) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x648770)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.243+0000     #1 0x56294c9de860 in mongo::parsed_aggregation_projection::ParsedAddFields::ParsedAddFields() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x1175860)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.243+0000     #2 0x56294c9d832f in mongo::parsed_aggregation_projection::ParsedAddFields::create(mongo::BSONObj const&) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x116f32f)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.244+0000     #3 0x56294c6c1b39 in mongo::DocumentSourceAddFields::createFromBson(mongo::BSONElement, boost::intrusive_ptr<mongo::ExpressionContext> const&) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0xe58b39)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.244+0000     #4 0x56294c07bde9 in DocumentSourceTests::DocumentSourceAddFields::AddFieldsTest::createAddFields(mongo::BSONObj const&) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x812de9)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.244+0000     #5 0x56294c00ff25 in DocumentSourceTests::DocumentSourceAddFields::UnitTest__AddFieldsTest__ProcessesMultipleDocuments::_doTest() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x7a6f25)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.245+0000     #6 0x56294cd8b604 in mongo::unittest::Test::run() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x1522604)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.245+0000     #7 0x56294c09bf27 in void mongo::unittest::Suite::runTestObject<DocumentSourceTests::DocumentSourceAddFields::UnitTest__AddFieldsTest__ProcessesMultipleDocuments>() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x832f27)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.246+0000     #8 0x56294cd8e987 in mongo::unittest::Suite::run(std::string const&, int) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x1525987)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.246+0000     #9 0x56294cd9240d in mongo::unittest::Suite::run(std::vector<std::string, std::allocator<std::string> > const&, std::string const&, int) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x152940d)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.246+0000     #10 0x56294cd9c91b in main (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x153391b)
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.246+0000     #11 0x7f65f36e782f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291
      ...
      [cpp_unit_test:document_source_test] 2016-08-12T02:08:04.661+0000 SUMMARY: AddressSanitizer: 9725 byte(s) leaked in 159 allocation(s).
      

      Show
      Compile and run the document_source_test C++ unit test under ASan. Output [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.238+0000 ================================================================= [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.238+0000 ==26605==ERROR: LeakSanitizer: detected memory leaks [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.238+0000 [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.238+0000 Direct leak of 168 byte(s) in 1 object(s) allocated from: [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.238+0000 #0 0x56294beb1770 in operator new(unsigned long) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x648770) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.239+0000 #1 0x56294c9de860 in mongo::parsed_aggregation_projection::ParsedAddFields::ParsedAddFields() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x1175860) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.239+0000 #2 0x56294c9d832f in mongo::parsed_aggregation_projection::ParsedAddFields::create(mongo::BSONObj const&) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x116f32f) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.240+0000 #3 0x56294c6c1b39 in mongo::DocumentSourceAddFields::createFromBson(mongo::BSONElement, boost::intrusive_ptr<mongo::ExpressionContext> const&) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0xe58b39) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.240+0000 #4 0x56294c07bde9 in DocumentSourceTests::DocumentSourceAddFields::AddFieldsTest::createAddFields(mongo::BSONObj const&) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x812de9) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.240+0000 #5 0x56294c00ce18 in DocumentSourceTests::DocumentSourceAddFields::UnitTest__AddFieldsTest__OptimizesInnerExpressions::_doTest() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x7a3e18) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.241+0000 #6 0x56294cd8b604 in mongo::unittest::Test::run() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x1522604) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.241+0000 #7 0x56294c09bc87 in void mongo::unittest::Suite::runTestObject<DocumentSourceTests::DocumentSourceAddFields::UnitTest__AddFieldsTest__OptimizesInnerExpressions>() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x832c87) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.241+0000 #8 0x56294cd8e987 in mongo::unittest::Suite::run(std::string const&, int) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x1525987) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.242+0000 #9 0x56294cd9240d in mongo::unittest::Suite::run(std::vector<std::string, std::allocator<std::string> > const&, std::string const&, int) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x152940d) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.242+0000 #10 0x56294cd9c91b in main (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x153391b) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.242+0000 #11 0x7f65f36e782f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291 [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.242+0000 [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.242+0000 Direct leak of 168 byte(s) in 1 object(s) allocated from: [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.243+0000 #0 0x56294beb1770 in operator new(unsigned long) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x648770) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.243+0000 #1 0x56294c9de860 in mongo::parsed_aggregation_projection::ParsedAddFields::ParsedAddFields() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x1175860) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.243+0000 #2 0x56294c9d832f in mongo::parsed_aggregation_projection::ParsedAddFields::create(mongo::BSONObj const&) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x116f32f) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.244+0000 #3 0x56294c6c1b39 in mongo::DocumentSourceAddFields::createFromBson(mongo::BSONElement, boost::intrusive_ptr<mongo::ExpressionContext> const&) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0xe58b39) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.244+0000 #4 0x56294c07bde9 in DocumentSourceTests::DocumentSourceAddFields::AddFieldsTest::createAddFields(mongo::BSONObj const&) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x812de9) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.244+0000 #5 0x56294c00ff25 in DocumentSourceTests::DocumentSourceAddFields::UnitTest__AddFieldsTest__ProcessesMultipleDocuments::_doTest() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x7a6f25) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.245+0000 #6 0x56294cd8b604 in mongo::unittest::Test::run() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x1522604) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.245+0000 #7 0x56294c09bf27 in void mongo::unittest::Suite::runTestObject<DocumentSourceTests::DocumentSourceAddFields::UnitTest__AddFieldsTest__ProcessesMultipleDocuments>() (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x832f27) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.246+0000 #8 0x56294cd8e987 in mongo::unittest::Suite::run(std::string const&, int) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x1525987) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.246+0000 #9 0x56294cd9240d in mongo::unittest::Suite::run(std::vector<std::string, std::allocator<std::string> > const&, std::string const&, int) (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x152940d) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.246+0000 #10 0x56294cd9c91b in main (/data/mci/57ff7efe49253ee0580414c7600c9863/src/build/build/mongo/db/pipeline/document_source_test+0x153391b) [cpp_unit_test:document_source_test] 2016-08-12T02:08:03.246+0000 #11 0x7f65f36e782f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291 ... [cpp_unit_test:document_source_test] 2016-08-12T02:08:04.661+0000 SUMMARY: AddressSanitizer: 9725 byte(s) leaked in 159 allocation(s).
    • Sprint:
      Query 2016-08-29
    • Linked BF Score:
      0

      Description

      The DocumentSourceSingleDocumentTransformation class owns a TransformerInterface - of which ParsedAddFields is a subclass. The TransformerInterface needs a virtual destructor to ensure that when the delete operator is invoked on the base class TransformerInterface, that the destructor of the derived class ParsedAddFields is called.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              max.hirschhorn Max Hirschhorn
              Reporter:
              max.hirschhorn Max Hirschhorn
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: