================================================================= ==26690==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000014c28 at pc 0x000000eb9a87 bp 0x7fffd2faf550 sp 0x7fffd2faf548 READ of size 8 at 0x604000014c28 thread T0 #0 0xeb9a86 in mongo::GeoNearExpression::toString() const /home/maxh/debugging/mongo/src/mongo/db/matcher/expression_geo.h:155:30 #1 0x15a3f7f in mongo::GeoNear2DSphereNode::appendToString(mongoutils::str::stream*, int) const /home/maxh/debugging/mongo/src/mongo/db/query/query_solution.cpp:800:30 #2 0x15043dd in mongo::QuerySolution::toString() /home/maxh/debugging/mongo/src/mongo/db/query/query_solution.h:211:9 #3 0x15288e1 in mongo::QueryPlannerTest::dumpSolutions(mongoutils::str::stream&) const /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_test_fixture.cpp:313:16 #4 0x1529504 in mongo::QueryPlannerTest::assertNumSolutions(unsigned long) const /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_test_fixture.cpp:321:5 #5 0x917e58 in (anonymous namespace)::QueryPlanner2dsphereVersionTest::testMultiple2dsphereIndexVersions(std::vector >, std::vector >, mongo::BSONObj, unsigned long) /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_geo_test.cpp:807:13 #6 0x9166d2 in (anonymous namespace)::UnitTest__QueryPlanner2dsphereVersionTest__TwoDNearCompound::_doTest() /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_geo_test.cpp:885:5 #7 0x16d2025 in mongo::unittest::Test::run() /home/maxh/debugging/mongo/src/mongo/unittest/unittest.cpp:147:9 #8 0x915001 in void mongo::unittest::Suite::runTestObject<(anonymous namespace)::UnitTest__QueryPlanner2dsphereVersionTest__TwoDNearCompound>() /home/maxh/debugging/mongo/src/mongo/unittest/unittest.h:410:9 #9 0x975816 in std::_Function_handler::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2071:2 #10 0x171860e in std::function::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2471:14 #11 0x16eb261 in mongo::unittest::TestHolder::run() const /home/maxh/debugging/mongo/src/mongo/unittest/unittest.h:257:9 #12 0x16d8cb2 in mongo::unittest::Suite::run(std::string const&, int) /home/maxh/debugging/mongo/src/mongo/unittest/unittest.cpp:270:17 #13 0x16dbf28 in mongo::unittest::Suite::run(std::vector > const&, std::string const&, int) /home/maxh/debugging/mongo/src/mongo/unittest/unittest.cpp:328:27 #14 0x171a90d in main /home/maxh/debugging/mongo/src/mongo/unittest/unittest_main.cpp:40:12 #15 0x7fcf3657bec4 in __libc_start_main /build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:287 #16 0x85cf69 in _start (/home/maxh/debugging/mongo/build/asan-debug/mongo/db/query/query_planner_geo_test+0x85cf69) 0x604000014c28 is located 24 bytes inside of 40-byte region [0x604000014c10,0x604000014c38) freed by thread T0 here: #0 0x903962 in operator delete(void*) (/home/maxh/debugging/mongo/build/asan-debug/mongo/db/query/query_planner_geo_test+0x903962) #1 0xec1c8f in std::_Sp_counted_ptr::_M_dispose() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/shared_ptr_base.h:290:9 #2 0x9cb49c in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/shared_ptr_base.h:144:6 #3 0x9cb239 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/shared_ptr_base.h:546:4 #4 0xec02c1 in std::__shared_ptr::~__shared_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/shared_ptr_base.h:781:8 #5 0xecb16a in std::shared_ptr::~shared_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/shared_ptr.h:93:11 #6 0xebb21a in mongo::GeoNearMatchExpression::~GeoNearMatchExpression() /home/maxh/debugging/mongo/src/mongo/db/matcher/expression_geo.h:168:40 #7 0xebb3f4 in mongo::GeoNearMatchExpression::~GeoNearMatchExpression() /home/maxh/debugging/mongo/src/mongo/db/matcher/expression_geo.h:168:39 #8 0x97d612 in std::default_delete::operator()(mongo::MatchExpression*) const /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/unique_ptr.h:67:2 #9 0x97a21e in std::unique_ptr >::~unique_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/unique_ptr.h:184:4 #10 0x979c01 in mongo::CanonicalQuery::~CanonicalQuery() /home/maxh/debugging/mongo/src/mongo/db/query/canonical_query.h:41:7 #11 0x979a13 in std::default_delete::operator()(mongo::CanonicalQuery*) const /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/unique_ptr.h:67:2 #12 0x977bfe in std::unique_ptr >::~unique_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/unique_ptr.h:184:4 #13 0x1076bb6 in boost::optional_detail::optional_base > >::destroy_impl(mpl_::bool_) /home/maxh/debugging/mongo/src/third_party/boost-1.60.0/boost/optional/optional.hpp:745:50 #14 0x10769db in boost::optional_detail::optional_base > >::destroy() /home/maxh/debugging/mongo/src/third_party/boost-1.60.0/boost/optional/optional.hpp:707:9 #15 0x107678c in boost::optional_detail::optional_base > >::~optional_base() /home/maxh/debugging/mongo/src/third_party/boost-1.60.0/boost/optional/optional.hpp:327:24 #16 0x107cc6a in boost::optional > >::~optional() /home/maxh/debugging/mongo/src/third_party/boost-1.60.0/boost/optional/optional.hpp:877:18 #17 0x153208e in mongo::StatusWith > >::~StatusWith() /home/maxh/debugging/mongo/src/mongo/db/query/lite_parsed_query.h:42:7 #18 0x1521600 in mongo::QueryPlannerTest::runQueryFull(mongo::BSONObj const&, mongo::BSONObj const&, mongo::BSONObj const&, long long, long long, mongo::BSONObj const&, mongo::BSONObj const&, mongo::BSONObj const&, bool) /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_test_fixture.cpp:216:1 #19 0x151eb29 in mongo::QueryPlannerTest::runQuerySortProjSkipLimitHint(mongo::BSONObj const&, mongo::BSONObj const&, mongo::BSONObj const&, long long, long long, mongo::BSONObj const&) /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_test_fixture.cpp:182:5 #20 0x151d393 in mongo::QueryPlannerTest::runQuerySortProjSkipLimit(mongo::BSONObj const&, mongo::BSONObj const&, mongo::BSONObj const&, long long, long long) /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_test_fixture.cpp:160:5 #21 0x151cc55 in mongo::QueryPlannerTest::runQuery(mongo::BSONObj) /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_test_fixture.cpp:138:5 #22 0x917dfe in (anonymous namespace)::QueryPlanner2dsphereVersionTest::testMultiple2dsphereIndexVersions(std::vector >, std::vector >, mongo::BSONObj, unsigned long) /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_geo_test.cpp:805:13 #23 0x9166d2 in (anonymous namespace)::UnitTest__QueryPlanner2dsphereVersionTest__TwoDNearCompound::_doTest() /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_geo_test.cpp:885:5 #24 0x16d2025 in mongo::unittest::Test::run() /home/maxh/debugging/mongo/src/mongo/unittest/unittest.cpp:147:9 #25 0x915001 in void mongo::unittest::Suite::runTestObject<(anonymous namespace)::UnitTest__QueryPlanner2dsphereVersionTest__TwoDNearCompound>() /home/maxh/debugging/mongo/src/mongo/unittest/unittest.h:410:9 #26 0x975816 in std::_Function_handler::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2071:2 #27 0x171860e in std::function::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2471:14 #28 0x16eb261 in mongo::unittest::TestHolder::run() const /home/maxh/debugging/mongo/src/mongo/unittest/unittest.h:257:9 #29 0x16d8cb2 in mongo::unittest::Suite::run(std::string const&, int) /home/maxh/debugging/mongo/src/mongo/unittest/unittest.cpp:270:17 previously allocated by thread T0 here: #0 0x9033a2 in operator new(unsigned long) (/home/maxh/debugging/mongo/build/asan-debug/mongo/db/query/query_planner_geo_test+0x9033a2) #1 0xfe0ccb in boost::detail::up_if_not_array::type boost::make_unique(char const*&) /home/maxh/debugging/mongo/src/third_party/boost-1.60.0/boost/smart_ptr/make_unique_object.hpp:28:35 #2 0xfdeade in mongo::expressionParserGeoCallbackReal(char const*, int, mongo::BSONObj const&) /home/maxh/debugging/mongo/src/mongo/db/matcher/expression_parser_geo.cpp:67:44 #3 0xf9b994 in std::_Function_handler > > (char const*, int, mongo::BSONObj const&), mongo::StatusWith > > (*)(char const*, int, mongo::BSONObj const&)>::_M_invoke(std::_Any_data const&, char const*, int, mongo::BSONObj const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2056:11 #4 0xf896de in std::function > > (char const*, int, mongo::BSONObj const&)>::operator()(char const*, int, mongo::BSONObj const&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2471:14 #5 0xf808c6 in mongo::MatchExpressionParser::_parseSub(char const*, mongo::BSONObj const&, mongo::AndMatchExpression*, int) /home/maxh/debugging/mongo/src/mongo/db/matcher/expression_parser.cpp:429:21 #6 0xf7d8ca in mongo::MatchExpressionParser::_parse(mongo::BSONObj const&, int) /home/maxh/debugging/mongo/src/mongo/db/matcher/expression_parser.cpp:364:24 #7 0x1023b3d in mongo::MatchExpressionParser::parse(mongo::BSONObj const&, mongo::ExtensionsCallback const&) /home/maxh/debugging/mongo/src/mongo/db/matcher/expression_parser.h:54:16 #8 0x104783c in mongo::CanonicalQuery::canonicalize(mongo::NamespaceString, mongo::BSONObj const&, mongo::BSONObj const&, mongo::BSONObj const&, long long, long long, mongo::BSONObj const&, mongo::BSONObj const&, mongo::BSONObj const&, bool, bool, mongo::ExtensionsCallback const&) /home/maxh/debugging/mongo/src/mongo/db/query/canonical_query.cpp:296:9 #9 0x15205b0 in mongo::QueryPlannerTest::runQueryFull(mongo::BSONObj const&, mongo::BSONObj const&, mongo::BSONObj const&, long long, long long, mongo::BSONObj const&, mongo::BSONObj const&, mongo::BSONObj const&, bool) /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_test_fixture.cpp:201:25 #10 0x151eb29 in mongo::QueryPlannerTest::runQuerySortProjSkipLimitHint(mongo::BSONObj const&, mongo::BSONObj const&, mongo::BSONObj const&, long long, long long, mongo::BSONObj const&) /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_test_fixture.cpp:182:5 #11 0x151d393 in mongo::QueryPlannerTest::runQuerySortProjSkipLimit(mongo::BSONObj const&, mongo::BSONObj const&, mongo::BSONObj const&, long long, long long) /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_test_fixture.cpp:160:5 #12 0x151cc55 in mongo::QueryPlannerTest::runQuery(mongo::BSONObj) /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_test_fixture.cpp:138:5 #13 0x917dfe in (anonymous namespace)::QueryPlanner2dsphereVersionTest::testMultiple2dsphereIndexVersions(std::vector >, std::vector >, mongo::BSONObj, unsigned long) /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_geo_test.cpp:805:13 #14 0x9166d2 in (anonymous namespace)::UnitTest__QueryPlanner2dsphereVersionTest__TwoDNearCompound::_doTest() /home/maxh/debugging/mongo/src/mongo/db/query/query_planner_geo_test.cpp:885:5 #15 0x16d2025 in mongo::unittest::Test::run() /home/maxh/debugging/mongo/src/mongo/unittest/unittest.cpp:147:9 #16 0x915001 in void mongo::unittest::Suite::runTestObject<(anonymous namespace)::UnitTest__QueryPlanner2dsphereVersionTest__TwoDNearCompound>() /home/maxh/debugging/mongo/src/mongo/unittest/unittest.h:410:9 #17 0x975816 in std::_Function_handler::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2071:2 #18 0x171860e in std::function::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2471:14 #19 0x16eb261 in mongo::unittest::TestHolder::run() const /home/maxh/debugging/mongo/src/mongo/unittest/unittest.h:257:9 #20 0x16d8cb2 in mongo::unittest::Suite::run(std::string const&, int) /home/maxh/debugging/mongo/src/mongo/unittest/unittest.cpp:270:17 #21 0x16dbf28 in mongo::unittest::Suite::run(std::vector > const&, std::string const&, int) /home/maxh/debugging/mongo/src/mongo/unittest/unittest.cpp:328:27 #22 0x171a90d in main /home/maxh/debugging/mongo/src/mongo/unittest/unittest_main.cpp:40:12 #23 0x7fcf3657bec4 in __libc_start_main /build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:287 SUMMARY: AddressSanitizer: heap-use-after-free /home/maxh/debugging/mongo/src/mongo/db/matcher/expression_geo.h:155 mongo::GeoNearExpression::toString() const