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

Unit test ExpressionTests::Set failure on Windows and C++11 builds

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.5.2
    • Affects Version/s: None
    • Component/s: Testing Infrastructure
    • Environment:
      Windows, OS X C++11 builds with libc++
    • ALL

      Windows and OSX C++11 builders have been failing unit tests recently.

      Example 1: Windows 64-bit Build #5644 (Aug 9, rev cd81198d)

      http://buildlogs.mongodb.org/Windows%2064-bit/builds/5644/test/core/test.exe

      Fri Aug 09 19:25:37.429 [testsuite] 	 going to run test: class ExpressionTests::Set::NoOverlap
      Fri Aug 09 19:25:37.429 [testsuite]  Assertion failure 0 D:\slave\Windows_64bit\mongo\src\mongo/bson/bsontypes.h 155
      Fri Aug 09 19:25:38.272 [testsuite] FAIL: class ExpressionTests::Set::NoOverlap	 std::exception: assertion D:\slave\Windows_64bit\mongo\src\mongo/bson/bsontypes.h:155 in test class ExpressionTests::Set::NoOverlap
      Fri Aug 09 19:25:38.272 [testsuite] 	 going to run test: class ExpressionTests::Set::Overlap
      Fri Aug 09 19:25:38.272 [testsuite] *** unhandled exception (access violation) at 0x000000013FC40176, terminating
      Fri Aug 09 19:25:38.272 [testsuite] *** access violation was a read from 0xFFFFFFFFFFFFFFFF
      

      Example 2: OS X C++11: http://buildlogs.mongodb.org/mci_0.9_osx_108_cxx11_debug/builds/198/test/core_0/test

      Mon Aug 12 17:24:44.241 [testsuite] expression           | tests:  298 | fails:    1 | assert calls:    680
      	ExpressionTests::Set::NoOverlap	for expression $setIntersection with argument [[1, 2], [8, 4]] full tree: {$setIntersection: [{$const: [1, 2]}, {$const: [8, 4]}]} expected: [] but got: [1] @src/mongo/dbtests/expressiontests.cpp:2930
      

      Windows: http://buildlogs.mongodb.org/mci_0.9_windows_64/builds/481/test/core_0/test.exe

      The breakage was bisected to: https://github.com/mongodb/mongo/commit/af6828e05aaea88e181cad598cc1274e2838d25a

      Running the test under valgrind on OS X shows a use after free:

      Mon Aug 12 19:28:18.169 [testsuite] 	 going to run test: ExpressionTests::Set::NoOverlap
      ==14518== Invalid read of size 8
      ==14518==    at 0x100DABD21: mongo::ExpressionSetIntersection::evaluateInternal(mongo::Variables const&) const (__hash_table:196)
      ==14518==    by 0x1001A00A5: mongo::Expression::evaluate(mongo::Variables const&) const (expression.h:127)
      ==14518==    by 0x10019FE16: mongo::Expression::evaluate(mongo::Document const&) const (expression.h:123)
      ==14518==    by 0x1001A38A5: ExpressionTests::Set::ExpectedResultBase::run() (expressiontests.cpp:2919)
      ==14518==    by 0x1001AA810: void mongo::unittest::Suite::runTestObject<ExpressionTests::Set::NoOverlap>() (unittest.h:296)
      ==14518==    by 0x10000AF89: boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) (function_template.hpp:112)
      ==14518==    by 0x1011D915A: boost::function0<void>::operator()() const (function_template.hpp:759)
      ==14518==    by 0x1011D398B: mongo::unittest::TestHolder::run() const (unittest.h:194)
      ==14518==    by 0x1011D04D5: mongo::unittest::Suite::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) (unittest.cpp:164)
      ==14518==    by 0x1011D1F77: mongo::unittest::Suite::run(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) (unittest.cpp:228)
      ==14518==    by 0x100F94D97: mongo::dbtests::runDbTests(int, char**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) (framework.cpp:270)
      ==14518==    by 0x100123355: dbtestsMain(int, char**, char**) (dbtests.cpp:40)
      ==14518==  Address 0x10681c460 is 0 bytes inside a block of size 32 free'd
      ==14518==    at 0x4D0B: free (vg_replace_malloc.c:450)
      ==14518==    by 0x100DB519A: std::__1::__hash_table<mongo::Value, mongo::Value::Hash, std::__1::equal_to<mongo::Value>, std::__1::allocator<mongo::Value> >::erase(std::__1::__hash_const_iterator<std::__1::__hash_node<mongo::Value, void*> const*>) (memory:1672)
      ==14518==    by 0x100DB4B97: unsigned long std::__1::__hash_table<mongo::Value, mongo::Value::Hash, std::__1::equal_to<mongo::Value>, std::__1::allocator<mongo::Value> >::__erase_unique<mongo::Value>(mongo::Value const&) (__hash_table:1731)
      ==14518==    by 0x100DABCCD: mongo::ExpressionSetIntersection::evaluateInternal(mongo::Variables const&) const (__hash_table:189)
      ==14518==    by 0x1001A00A5: mongo::Expression::evaluate(mongo::Variables const&) const (expression.h:127)
      ==14518==    by 0x10019FE16: mongo::Expression::evaluate(mongo::Document const&) const (expression.h:123)
      ==14518==    by 0x1001A38A5: ExpressionTests::Set::ExpectedResultBase::run() (expressiontests.cpp:2919)
      ==14518==    by 0x1001AA810: void mongo::unittest::Suite::runTestObject<ExpressionTests::Set::NoOverlap>() (unittest.h:296)
      ==14518==    by 0x10000AF89: boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) (function_template.hpp:112)
      ==14518==    by 0x1011D915A: boost::function0<void>::operator()() const (function_template.hpp:759)
      ==14518==    by 0x1011D398B: mongo::unittest::TestHolder::run() const (unittest.h:194)
      ==14518==    by 0x1011D04D5: mongo::unittest::Suite::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) (unittest.cpp:164)
      ==14518==
      Mon Aug 12 19:28:18.278 [testsuite] FAIL: ExpressionTests::Set::NoOverlap	for expression $setIntersection with argument [[1, 2], [8, 4]] full tree: {$setIntersection: [{$const: [1, 2]}, {$const: [8, 4]}]} expected: [] but got: [1] @src/mongo/dbtests/expressiontests.cpp:2930
      

            Assignee:
            matt.dannenberg Matt Dannenberg
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: