I am working on the p0 project for 15-445 fall: https://15445.courses.cs.cmu.edu/fall2023/project0/ as a side hobby. I am no C++ programmer so hope to learn something more in-depth regarding C++ via this course. But there’s a test that I cannot pass for the auto grader. It’s a ASAN error from a concurrent tests regarding double free:
➜ build git:(master) ✗ ./test/trie_store_test --gtest_filter=TrieStoreTest.MixedConcurrentTest
Running main() from gmock_main.cc
Note: Google Test filter = TrieStoreTest.MixedConcurrentTest
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TrieStoreTest
[ RUN ] TrieStoreTest.MixedConcurrentTest
=================================================================
==28738==ERROR: AddressSanitizer: attempting double-free on 0x000108b92780 in thread T2:
#0 0x10593dbcc in wrap__ZdlPv+0x74 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x61bcc)
#1 0x104a45924 in void std::__1::__libcpp_operator_delete[abi:v160006]<void*>(void*) new:295
#2 0x104a458d4 in void std::__1::__do_deallocate_handle_size[abi:v160006]<>(void*, unsigned long) new:319
#3 0x104a45858 in std::__1::__libcpp_deallocate[abi:v160006](void*, unsigned long, unsigned long) new:335
#4 0x104ab0330 in std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>>::deallocate[abi:v160006](std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*, unsigned long) allocator.h:131
#5 0x104ab0298 in std::__1::allocator_traits<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>>>::deallocate[abi:v160006](std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>>&, std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*, unsigned long) allocator_traits.h:288
#6 0x104ab0d60 in std::__1::__tree<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__map_value_compare<char, std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::less<char>, true>, std::__1::allocator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*) __tree:1814
#7 0x104ab0c40 in std::__1::__tree<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__map_value_compare<char, std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::less<char>, true>, std::__1::allocator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>>>::~__tree() __tree:1801
#8 0x104aa9928 in std::__1::__tree<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__map_value_compare<char, std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::less<char>, true>, std::__1::allocator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>>>::~__tree() __tree:1798
#9 0x104ab19f8 in std::__1::map<char, std::__1::shared_ptr<bustub::TrieNode const>, std::__1::less<char>, std::__1::allocator<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>>>>::~map[abi:v160006]() map:1164
#10 0x104aa8a48 in std::__1::map<char, std::__1::shared_ptr<bustub::TrieNode const>, std::__1::less<char>, std::__1::allocator<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>>>>::~map[abi:v160006]() map:1162
#11 0x104ab12f8 in bustub::TrieNode::~TrieNode() trie.h:52
#12 0x104ab0ebc in bustub::TrieNode::~TrieNode() trie.h:52
#13 0x104ab0ee8 in bustub::TrieNode::~TrieNode() trie.h:52
#14 0x104aa79bc in std::__1::default_delete<bustub::TrieNode>::operator()[abi:v160006](bustub::TrieNode*) const unique_ptr.h:65
#15 0x104ab4408 in std::__1::__shared_ptr_pointer<bustub::TrieNode*, std::__1::default_delete<bustub::TrieNode>, std::__1::allocator<bustub::TrieNode>>::__on_zero_shared() shared_ptr.h:246
#16 0x104a3b018 in std::__1::__shared_count::__release_shared[abi:v160006]() shared_ptr.h:157
#17 0x104a3af3c in std::__1::__shared_weak_count::__release_shared[abi:v160006]() shared_ptr.h:198
#18 0x104a3af0c in std::__1::shared_ptr<bustub::TrieNode const>::~shared_ptr[abi:v160006]() shared_ptr.h:745
#19 0x104a3ae48 in std::__1::shared_ptr<bustub::TrieNode const>::~shared_ptr[abi:v160006]() shared_ptr.h:743
#20 0x104a3ae1c in bustub::Trie::~Trie() trie.h:104
#21 0x104a3adf0 in bustub::Trie::~Trie() trie.h:104
#22 0x104ad6154 in void bustub::TrieStore::Put<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>) trie_store.cpp:36
#23 0x104a4808c in bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0::operator()() const trie_store_test.cpp:97
#24 0x104a47148 in decltype(std::declval<bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0>()()) std::__1::__invoke[abi:v160006]<bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0>(bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0&&) invoke.h:394
#25 0x104a470e4 in void std::__1::__thread_execute[abi:v160006]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0>&, std::__1::__tuple_indices<>) thread:288
#26 0x104a45ffc in void* std::__1::__thread_proxy[abi:v160006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0>>(void*) thread:299
#27 0x187157030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
#28 0x187151e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)
0x000108b92780 is located 0 bytes inside of 56-byte region [0x000108b92780,0x000108b927b8)
freed by thread T7 here:
#0 0x10593dbcc in wrap__ZdlPv+0x74 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x61bcc)
#1 0x104a45924 in void std::__1::__libcpp_operator_delete[abi:v160006]<void*>(void*) new:295
#2 0x104a458d4 in void std::__1::__do_deallocate_handle_size[abi:v160006]<>(void*, unsigned long) new:319
#3 0x104a45858 in std::__1::__libcpp_deallocate[abi:v160006](void*, unsigned long, unsigned long) new:335
#4 0x104ab0330 in std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>>::deallocate[abi:v160006](std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*, unsigned long) allocator.h:131
#5 0x104ab0298 in std::__1::allocator_traits<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>>>::deallocate[abi:v160006](std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>>&, std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*, unsigned long) allocator_traits.h:288
#6 0x104ab0d60 in std::__1::__tree<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__map_value_compare<char, std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::less<char>, true>, std::__1::allocator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>>>::destroy(std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*) __tree:1814
#7 0x104ab0c40 in std::__1::__tree<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__map_value_compare<char, std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::less<char>, true>, std::__1::allocator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>>>::~__tree() __tree:1801
#8 0x104aa9928 in std::__1::__tree<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__map_value_compare<char, std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::less<char>, true>, std::__1::allocator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>>>::~__tree() __tree:1798
#9 0x104ab19f8 in std::__1::map<char, std::__1::shared_ptr<bustub::TrieNode const>, std::__1::less<char>, std::__1::allocator<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>>>>::~map[abi:v160006]() map:1164
#10 0x104aa8a48 in std::__1::map<char, std::__1::shared_ptr<bustub::TrieNode const>, std::__1::less<char>, std::__1::allocator<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>>>>::~map[abi:v160006]() map:1162
#11 0x104ab12f8 in bustub::TrieNode::~TrieNode() trie.h:52
#12 0x104ab0ebc in bustub::TrieNode::~TrieNode() trie.h:52
#13 0x104ab0ee8 in bustub::TrieNode::~TrieNode() trie.h:52
#14 0x104aa79bc in std::__1::default_delete<bustub::TrieNode>::operator()[abi:v160006](bustub::TrieNode*) const unique_ptr.h:65
#15 0x104ab4408 in std::__1::__shared_ptr_pointer<bustub::TrieNode*, std::__1::default_delete<bustub::TrieNode>, std::__1::allocator<bustub::TrieNode>>::__on_zero_shared() shared_ptr.h:246
#16 0x104a3b018 in std::__1::__shared_count::__release_shared[abi:v160006]() shared_ptr.h:157
#17 0x104a3af3c in std::__1::__shared_weak_count::__release_shared[abi:v160006]() shared_ptr.h:198
#18 0x104a3af0c in std::__1::shared_ptr<bustub::TrieNode const>::~shared_ptr[abi:v160006]() shared_ptr.h:745
#19 0x104a3ae48 in std::__1::shared_ptr<bustub::TrieNode const>::~shared_ptr[abi:v160006]() shared_ptr.h:743
#20 0x104a3ae1c in bustub::Trie::~Trie() trie.h:104
#21 0x104a3adf0 in bustub::Trie::~Trie() trie.h:104
#22 0x104ad5c40 in std::__1::optional<bustub::ValueGuard<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> bustub::TrieStore::Get<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>(std::__1::basic_string_view<char, std::__1::char_traits<char>>) trie_store.cpp:25
#23 0x104a51f30 in bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_1::operator()() const trie_store_test.cpp:120
#24 0x104a51770 in decltype(std::declval<bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_1>()()) std::__1::__invoke[abi:v160006]<bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_1>(bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_1&&) invoke.h:394
#25 0x104a5174c in void std::__1::__thread_execute[abi:v160006]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_1>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_1>&, std::__1::__tuple_indices<>) thread:288
#26 0x104a50d7c in void* std::__1::__thread_proxy[abi:v160006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_1>>(void*) thread:299
#27 0x187157030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
#28 0x187151e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)
previously allocated by thread T2 here:
#0 0x10593d78c in wrap__Znwm+0x74 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x6178c)
#1 0x104a4c780 in void* std::__1::__libcpp_operator_new[abi:v160006]<unsigned long>(unsigned long) new:285
#2 0x104a4c724 in std::__1::__libcpp_allocate[abi:v160006](unsigned long, unsigned long) new:311
#3 0x104aae7f0 in std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>>::allocate[abi:v160006](unsigned long) allocator.h:115
#4 0x104aae5ec in std::__1::allocator_traits<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>>>::allocate[abi:v160006](std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>>&, unsigned long) allocator_traits.h:268
#5 0x104aac308 in std::__1::unique_ptr<std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>, std::__1::__tree_node_destructor<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>>>> std::__1::__tree<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__map_value_compare<char, std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::less<char>, true>, std::__1::allocator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>>>::__construct_node<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>> const&>(std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>> const&) __tree:2145
#6 0x104aab2f8 in std::__1::pair<std::__1::__tree_iterator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*, long>, bool> std::__1::__tree<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__map_value_compare<char, std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::less<char>, true>, std::__1::allocator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>>>::__emplace_hint_unique_key_args<char, std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>> const&>(std::__1::__tree_const_iterator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*, long>, char const&, std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>> const&) __tree:2129
#7 0x104aaaba4 in std::__1::__tree<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__map_value_compare<char, std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::less<char>, true>, std::__1::allocator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>>>::__insert_unique[abi:v160006](std::__1::__tree_const_iterator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*, long>, std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>> const&) __tree:1273
#8 0x104aaa474 in std::__1::map<char, std::__1::shared_ptr<bustub::TrieNode const>, std::__1::less<char>, std::__1::allocator<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>>>>::insert[abi:v160006](std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*, long>>, std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>> const&) map:1252
#9 0x104aa9544 in void std::__1::map<char, std::__1::shared_ptr<bustub::TrieNode const>, std::__1::less<char>, std::__1::allocator<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>>>>::insert[abi:v160006]<std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*, long>>>(std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*, long>>, std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, std::__1::__tree_node<std::__1::__value_type<char, std::__1::shared_ptr<bustub::TrieNode const>>, void*>*, long>>) map:1273
#10 0x104aa9084 in std::__1::map<char, std::__1::shared_ptr<bustub::TrieNode const>, std::__1::less<char>, std::__1::allocator<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>>>>::map[abi:v160006](std::__1::map<char, std::__1::shared_ptr<bustub::TrieNode const>, std::__1::less<char>, std::__1::allocator<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>>>> const&) map:1081
#11 0x104aa89e8 in std::__1::map<char, std::__1::shared_ptr<bustub::TrieNode const>, std::__1::less<char>, std::__1::allocator<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>>>>::map[abi:v160006](std::__1::map<char, std::__1::shared_ptr<bustub::TrieNode const>, std::__1::less<char>, std::__1::allocator<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>>>> const&) map:1080
#12 0x104ab1474 in std::__1::__unique_if<bustub::TrieNode>::__unique_single std::__1::make_unique[abi:v160006]<bustub::TrieNode, std::__1::map<char, std::__1::shared_ptr<bustub::TrieNode const>, std::__1::less<char>, std::__1::allocator<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>>>> const&>(std::__1::map<char, std::__1::shared_ptr<bustub::TrieNode const>, std::__1::less<char>, std::__1::allocator<std::__1::pair<char const, std::__1::shared_ptr<bustub::TrieNode const>>>> const&) unique_ptr.h:686
#13 0x104ab0f20 in bustub::TrieNode::Clone() const trie.h:61
#14 0x104a92a70 in bustub::Trie bustub::Trie::Put<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>) const trie.cpp:46
#15 0x104ad6114 in void bustub::TrieStore::Put<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>) trie_store.cpp:35
#16 0x104a4808c in bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0::operator()() const trie_store_test.cpp:97
#17 0x104a47148 in decltype(std::declval<bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0>()()) std::__1::__invoke[abi:v160006]<bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0>(bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0&&) invoke.h:394
#18 0x104a470e4 in void std::__1::__thread_execute[abi:v160006]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0>&, std::__1::__tuple_indices<>) thread:288
#19 0x104a45ffc in void* std::__1::__thread_proxy[abi:v160006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0>>(void*) thread:299
#20 0x187157030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
#21 0x187151e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)
Thread T2 created by T0 here:
#0 0x1059281b0 in wrap_pthread_create+0x54 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x4c1b0)
#1 0x104a45e7c in std::__1::__libcpp_thread_create[abi:v160006](_opaque_pthread_t**, void* (*)(void*), void*) __threading_support:378
#2 0x104a45b94 in std::__1::thread::thread<bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0, void>(bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0&&) thread:315
#3 0x104a398ec in std::__1::thread::thread<bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0, void>(bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_0&&) thread:307
#4 0x104a38314 in bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody() trie_store_test.cpp:93
#5 0x104be0afc in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) gtest.cc:2612
#6 0x104b23548 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) gtest.cc:2648
#7 0x104b23148 in testing::Test::Run() gtest.cc:2687
#8 0x104b261cc in testing::TestInfo::Run() gtest.cc:2836
#9 0x104b2952c in testing::TestSuite::Run() gtest.cc:3015
#10 0x104b50a80 in testing::internal::UnitTestImpl::RunAllTests() gtest.cc:5920
#11 0x104c18fb8 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) gtest.cc:2612
#12 0x104b4f9e8 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) gtest.cc:2648
#13 0x104b4f50c in testing::UnitTest::Run() gtest.cc:5484
#14 0x104c36948 in RUN_ALL_TESTS() gtest.h:2317
#15 0x104c36898 in main gmock_main.cc:71
#16 0x186ddd054 (<unknown module>)
Thread T7 created by T0 here:
#0 0x1059281b0 in wrap_pthread_create+0x54 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x4c1b0)
#1 0x104a45e7c in std::__1::__libcpp_thread_create[abi:v160006](_opaque_pthread_t**, void* (*)(void*), void*) __threading_support:378
#2 0x104a50980 in std::__1::thread::thread<bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_1, void>(bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_1&&) thread:315
#3 0x104a39c1c in std::__1::thread::thread<bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_1, void>(bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody()::$_1&&) thread:307
#4 0x104a38574 in bustub::TrieStoreTest_MixedConcurrentTest_Test::TestBody() trie_store_test.cpp:116
#5 0x104be0afc in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) gtest.cc:2612
#6 0x104b23548 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) gtest.cc:2648
#7 0x104b23148 in testing::Test::Run() gtest.cc:2687
#8 0x104b261cc in testing::TestInfo::Run() gtest.cc:2836
#9 0x104b2952c in testing::TestSuite::Run() gtest.cc:3015
#10 0x104b50a80 in testing::internal::UnitTestImpl::RunAllTests() gtest.cc:5920
#11 0x104c18fb8 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) gtest.cc:2612
#12 0x104b4f9e8 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) gtest.cc:2648
#13 0x104b4f50c in testing::UnitTest::Run() gtest.cc:5484
#14 0x104c36948 in RUN_ALL_TESTS() gtest.h:2317
#15 0x104c36898 in main gmock_main.cc:71
#16 0x186ddd054 (<unknown module>)
SUMMARY: AddressSanitizer: double-free (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x61bcc) in wrap__ZdlPv+0x74
==28738==ABORTING
[1] 28738 abort ./test/trie_store_test --gtest_filter=TrieStoreTest.MixedConcurrentTest
However I don’t have any explicit usage of pointers in my source file. For sequential test it’s easy to tell but I am quite struggled with debugging the concurrent tests. Any suggestions or guidance regarding how should I approach this problem? Many thanks!
Ethan Q. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.