cmu-db / peloton

The Self-Driving Database Management System
http://pelotondb.io
Apache License 2.0
2.03k stars 624 forks source link

Address sanitizer fails in art_index_test #1413

Open tcm-marcel opened 6 years ago

tcm-marcel commented 6 years ago

The address sanitizer reports an error in the art_index_test in the Travis Mac build for PR #1244, which is not related to the ART index.

The error appears in the test case NonUniqueKeyMultiThreadedStressTest:

Output of address sanitizer (incomplete) ``` 78: [ RUN ] ArtIndexTests.NonUniqueKeyMultiThreadedStressTest 78: 2018-06-15 21:07:49 [test/index/testing_index_util.cpp:688:BuildTestIndexMetadata] DEBUG - Build index type: ART [unique_keys=0] 78: ================================================================= 78: ==20455==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61700004fd18 at pc 0x0001116af4b7 bp 0x7000080d4ff0 sp 0x7000080d4fe8 78: READ of size 8 at 0x61700004fd18 thread T12 78: #0 0x1116af4b6 in art::Node48::getChild(unsigned char) const Node48_impl.h:32 78: #1 0x1116b8112 in art::Node::getChild(unsigned char, art::Node const*) Node_impl.h:214 78: #2 0x1116cbdd1 in art::Tree::remove(art::Key const&, unsigned long long, art::ThreadInfo&) Tree.cpp:564 78: #3 0x110944c4e in peloton::index::ArtIndex::DeleteEntry(peloton::storage::Tuple const*, peloton::ItemPointer*) art_index.cpp:88 78: #4 0x10f4bfa15 in peloton::test::ArtIndexTests::DeleteHelper(peloton::index::Index*, std::__1::vector > const*, peloton::ItemPointer*, unsigned long long) art_index_test.cpp:127 78: #5 0x10f4fdb20 in void* std::__1::__thread_proxy > const*, peloton::ItemPointer*, unsigned long long), peloton::index::Index*, std::__1::vector > const*, peloton::ItemPointer*, unsigned long long> >(void*) __functional_base:416 78: #6 0x7fffadcad93a in _pthread_body (libsystem_pthread.dylib:x86_64+0x393a) 78: #7 0x7fffadcad886 in _pthread_start (libsystem_pthread.dylib:x86_64+0x3886) 78: #8 0x7fffadcad08c in thread_start (libsystem_pthread.dylib:x86_64+0x308c) 78: 78: 0x61700004fd18 is located 0 bytes to the right of 664-byte region [0x61700004fa80,0x61700004fd18) 78: allocated by thread T8 here: 78: #0 0x114b21ffc in wrap_malloc (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x52ffc) 78: #1 0x11035375c in peloton::do_allocation(unsigned long, bool) allocator.cpp:29 78: #2 0x110353809 in operator new(unsigned long) allocator.cpp:42 78: #3 0x1116ba932 in void art::Node::insertGrow(art::Node16*, unsigned long long, art::Node*, unsigned long long, unsigned char, unsigned char, art::Node*, bool&, art::ThreadInfo&) Node_impl.h:351 78: #4 0x1116b9ca8 in art::Node::insertAndUnlock(art::Node*, unsigned long long, art::Node*, unsigned long long, unsigned char, unsigned char, art::Node*, bool&, art::ThreadInfo&) Node_impl.h:474 78: #5 0x1116c99bf in art::Tree::conditionalInsert(art::Key const&, unsigned long long, std::__1::function, art::ThreadInfo&) Tree.cpp:490 78: #6 0x1116c8922 in art::Tree::insert(art::Key const&, unsigned long long, art::ThreadInfo&) Tree.cpp:416 78: #7 0x11094477e in peloton::index::ArtIndex::InsertEntry(peloton::storage::Tuple const*, peloton::ItemPointer*) art_index.cpp:66 78: #8 0x10f4b9cca in peloton::test::ArtIndexTests::InsertHelper(peloton::index::Index*, std::__1::vector > const*, unsigned long long) art_index_test.cpp:105 78: #9 0x10f4fb4a0 in void* std::__1::__thread_proxy > const*, unsigned long long), peloton::index::Index*, std::__1::vector > const*, unsigned long long> >(void*) __functional_base:416 78: #10 0x7fffadcad93a in _pthread_body (libsystem_pthread.dylib:x86_64+0x393a) 78: #11 0x7fffadcad886 in _pthread_start (libsystem_pthread.dylib:x86_64+0x3886) 78: #12 0x7fffadcad08c in thread_start (libsystem_pthread.dylib:x86_64+0x308c) ```

Complete output

tcm-marcel commented 6 years ago

Valgrind memcheck with --leak-check=full --show-leak-kinds=all doesn't find any problems:

==14894== LEAK SUMMARY:
==14894==    definitely lost: 0 bytes in 0 blocks
==14894==    indirectly lost: 0 bytes in 0 blocks
==14894==      possibly lost: 0 bytes in 0 blocks
==14894==    still reachable: 5,085,637 bytes in 68,578 blocks
==14894==         suppressed: 0 bytes in 0 blocks
==14894== 
==14894== For counts of detected and suppressed errors, rerun with: -v
==14894== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
tcm-marcel commented 6 years ago

The error didn't appear after rerunning travis without code changes: https://travis-ci.org/cmu-db/peloton/builds/392879558