StarRocks / starrocks

The world's fastest open query engine for sub-second analytics both on and off the data lakehouse. With the flexibility to support nearly any scenario, StarRocks provides best-in-class performance for multi-dimensional analytics, real-time analytics, and ad-hoc queries. A Linux Foundation project.
https://starrocks.io
Apache License 2.0
8.93k stars 1.79k forks source link

be crash #4193

Closed wanpengfei-git closed 2 years ago

wanpengfei-git commented 2 years ago

Steps to reproduce the behavior (Required)

==5470==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000c856f0 at pc 0x000004aacaaa bp 0x7ffda8367970 sp 0x7ffda8367968
READ of size 8 at 0x603000c856f0 thread T0
    #0 0x4aacaa9 in std::__cxx11::list<starrocks::MemTracker*, std::allocator<starrocks::MemTracker*> >::erase(std::_List_const_iterator<starrocks::MemTracker*>) /usr/include/c++/10.3.0/bits/list.tcc:157
    #1 0x4aab672 in starrocks::MemTracker::unregister_from_parent() /root/starrocks/be/src/runtime/mem_tracker.h:104
    #2 0x4aa453d in starrocks::MemTracker::~MemTracker() /root/starrocks/be/src/runtime/mem_tracker.cpp:102
    #3 0x563968d in void __gnu_cxx::new_allocator<starrocks::MemTracker>::destroy<starrocks::MemTracker>(starrocks::MemTracker*) /usr/include/c++/10.3.0/ext/new_allocator.h:156
    #4 0x56394c0 in void std::allocator_traits<std::allocator<starrocks::MemTracker> >::destroy<starrocks::MemTracker>(std::allocator<starrocks::MemTracker>&, starrocks::MemTracker*) /usr/include/c++/10.3.0/bits/alloc_traits.h:531
    #5 0x5638d98 in std::_Sp_counted_ptr_inplace<starrocks::MemTracker, std::allocator<starrocks::MemTracker>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:560
    #6 0x42e1bbc in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:158
    #7 0x42deb29 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:733
    #8 0x54195fd in std::__shared_ptr<starrocks::MemTracker, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:1183
    #9 0x5419619 in std::shared_ptr<starrocks::MemTracker>::~shared_ptr() /usr/include/c++/10.3.0/bits/shared_ptr.h:121
    #10 0x5626618 in starrocks::RuntimeState::~RuntimeState() /root/starrocks/be/src/runtime/runtime_state.cpp:102
    #11 0x6e85389 in std::default_delete<starrocks::RuntimeState>::operator()(starrocks::RuntimeState*) const /usr/include/c++/10.3.0/bits/unique_ptr.h:85
    #12 0x6ea3b9e in std::_Sp_counted_deleter<starrocks::RuntimeState*, std::default_delete<starrocks::RuntimeState>, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:474
    #13 0x42e1bbc in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:158
    #14 0x42deb29 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:733
    #15 0x5496395 in std::__shared_ptr<starrocks::RuntimeState, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:1183
    #16 0x54963b1 in std::shared_ptr<starrocks::RuntimeState>::~shared_ptr() /usr/include/c++/10.3.0/bits/shared_ptr.h:121
    #17 0x6e775f3 in starrocks::pipeline::FragmentContext::~FragmentContext() /root/starrocks/be/src/exec/pipeline/fragment_context.h:31
    #18 0x6e85031 in std::default_delete<starrocks::pipeline::FragmentContext>::operator()(starrocks::pipeline::FragmentContext*) const /usr/include/c++/10.3.0/bits/unique_ptr.h:85
    #19 0x6ea394a in std::_Sp_counted_deleter<starrocks::pipeline::FragmentContext*, std::default_delete<starrocks::pipeline::FragmentContext>, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:474
    #20 0x42e1bbc in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:158
    #21 0x42deb29 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:733
    #22 0x556e8b9 in std::__shared_ptr<starrocks::pipeline::FragmentContext, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:1183
    #23 0x556e8d5 in std::shared_ptr<starrocks::pipeline::FragmentContext>::~shared_ptr() /usr/include/c++/10.3.0/bits/shared_ptr.h:121
    #24 0x6f674c5 in std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> >::~pair() /usr/include/c++/10.3.0/bits/stl_pair.h:211
    #25 0x6f674f1 in void __gnu_cxx::new_allocator<std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> >, true> >::destroy<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> > >(std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> >*) /usr/include/c++/10.3.0/ext/new_allocator.h:156
    #26 0x6f66fab in void std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> >, true> > >::destroy<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> > >(std::allocator<std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> >, true> >&, std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> >*) /usr/include/c++/10.3.0/bits/alloc_traits.h:531
    #27 0x6f66672 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> >, true> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> >, true>*) /usr/include/c++/10.3.0/bits/hashtable_policy.h:2053
    #28 0x6f6d18b in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> >, true> > >::_M_deallocate_nodes(std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> >, true>*) /usr/include/c++/10.3.0/bits/hashtable_policy.h:2075
    #29 0x6f6c23d in std::_Hashtable<starrocks::TUniqueId, std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> >, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> > >, std::__detail::_Select1st, std::equal_to<starrocks::TUniqueId>, std::hash<starrocks::TUniqueId>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::clear() /usr/include/c++/10.3.0/bits/hashtable.h:2030
    #30 0x6f6b88d in std::_Hashtable<starrocks::TUniqueId, std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> >, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> > >, std::__detail::_Select1st, std::equal_to<starrocks::TUniqueId>, std::hash<starrocks::TUniqueId>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::~_Hashtable() /usr/include/c++/10.3.0/bits/hashtable.h:1387
    #31 0x6f6b769 in std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::FragmentContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::FragmentContext> > > >::~unordered_map() /usr/include/c++/10.3.0/bits/unordered_map.h:102
    #32 0x6f6c3c3 in starrocks::pipeline::FragmentContextManager::~FragmentContextManager() /root/starrocks/be/src/exec/pipeline/fragment_context.h:172
    #33 0x6f6c3e9 in std::default_delete<starrocks::pipeline::FragmentContextManager>::operator()(starrocks::pipeline::FragmentContextManager*) const /usr/include/c++/10.3.0/bits/unique_ptr.h:85
    #34 0x6f6ba30 in std::unique_ptr<starrocks::pipeline::FragmentContextManager, std::default_delete<starrocks::pipeline::FragmentContextManager> >::~unique_ptr() /usr/include/c++/10.3.0/bits/unique_ptr.h:361
    #35 0x6f68b06 in starrocks::pipeline::QueryContext::~QueryContext() /root/starrocks/be/src/exec/pipeline/query_context.cpp:16
    #36 0x6f71ae3 in void __gnu_cxx::new_allocator<starrocks::pipeline::QueryContext>::destroy<starrocks::pipeline::QueryContext>(starrocks::pipeline::QueryContext*) /usr/include/c++/10.3.0/ext/new_allocator.h:156
    #37 0x6f71ab6 in void std::allocator_traits<std::allocator<starrocks::pipeline::QueryContext> >::destroy<starrocks::pipeline::QueryContext>(std::allocator<starrocks::pipeline::QueryContext>&, starrocks::pipeline::QueryContext*) /usr/include/c++/10.3.0/bits/alloc_traits.h:531
    #38 0x6f718d4 in std::_Sp_counted_ptr_inplace<starrocks::pipeline::QueryContext, std::allocator<starrocks::pipeline::QueryContext>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:560
    #39 0x42e1bbc in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:158
    #40 0x42deb29 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:733
    #41 0x556e87d in std::__shared_ptr<starrocks::pipeline::QueryContext, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/include/c++/10.3.0/bits/shared_ptr_base.h:1183
    #42 0x556e899 in std::shared_ptr<starrocks::pipeline::QueryContext>::~shared_ptr() /usr/include/c++/10.3.0/bits/shared_ptr.h:121
    #43 0x6f70fad in std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> >::~pair() /usr/include/c++/10.3.0/bits/stl_pair.h:211
    #44 0x6f70fd9 in void __gnu_cxx::new_allocator<std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> >, true> >::destroy<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > >(std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> >*) /usr/include/c++/10.3.0/ext/new_allocator.h:156
    #45 0x6f7060a in void std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> >, true> > >::destroy<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > >(std::allocator<std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> >, true> >&, std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> >*) /usr/include/c++/10.3.0/bits/alloc_traits.h:531
    #46 0x6f6f7d8 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> >, true> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> >, true>*) /usr/include/c++/10.3.0/bits/hashtable_policy.h:2053
    #47 0x6f7134b in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> >, true> > >::_M_deallocate_nodes(std::__detail::_Hash_node<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> >, true>*) /usr/include/c++/10.3.0/bits/hashtable_policy.h:2075
    #48 0x6f70e3f in std::_Hashtable<starrocks::TUniqueId, std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> >, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > >, std::__detail::_Select1st, std::equal_to<starrocks::TUniqueId>, std::hash<starrocks::TUniqueId>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::clear() /usr/include/c++/10.3.0/bits/hashtable.h:2030
    #49 0x6f70551 in std::_Hashtable<starrocks::TUniqueId, std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> >, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > >, std::__detail::_Select1st, std::equal_to<starrocks::TUniqueId>, std::hash<starrocks::TUniqueId>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::~_Hashtable() /usr/include/c++/10.3.0/bits/hashtable.h:1387
    #50 0x6f6f4bf in std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > >::~unordered_map() /usr/include/c++/10.3.0/bits/unordered_map.h:102
    #51 0x6f6f4da in void std::_Destroy<std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > > >(std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > >*) /usr/include/c++/10.3.0/bits/stl_construct.h:140
    #52 0x6f6e42b in void std::_Destroy_aux<false>::__destroy<std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > >*>(std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > >*, std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > >*) /usr/include/c++/10.3.0/bits/stl_construct.h:152
    #53 0x6f6d838 in void std::_Destroy<std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > >*>(std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > >*, std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > >*) /usr/include/c++/10.3.0/bits/stl_construct.h:185
    #54 0x6f6ca64 in void std::_Destroy<std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > >*, std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > > >(std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > >*, std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > >*, std::allocator<std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > > >&) /usr/include/c++/10.3.0/bits/alloc_traits.h:738
    #55 0x6f6bd03 in std::vector<std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > >, std::allocator<std::unordered_map<starrocks::TUniqueId, std::shared_ptr<starrocks::pipeline::QueryContext>, std::hash<starrocks::TUniqueId>, std::equal_to<starrocks::TUniqueId>, std::allocator<std::pair<starrocks::TUniqueId const, std::shared_ptr<starrocks::pipeline::QueryContext> > > > > >::~vector() /usr/include/c++/10.3.0/bits/stl_vector.h:680
    #56 0x6f68df3 in starrocks::pipeline::QueryContextManager::~QueryContextManager() /root/starrocks/be/src/exec/pipeline/query_context.cpp:43
    #57 0x7f9c16ae3c98 in __run_exit_handlers (/lib64/libc.so.6+0x39c98)
    #58 0x7f9c16ae3ce6 in exit (/lib64/libc.so.6+0x39ce6)
    #59 0x7f9c16acc50b in __libc_start_main (/lib64/libc.so.6+0x2250b)
    #60 0x420c28d  (/home/disk1/dorisdb/sqlancer_master_asan/be/lib/starrocks_be+0x420c28d)

0x603000c856f0 is located 0 bytes inside of 24-byte region [0x603000c856f0,0x603000c85708)
freed by thread T0 here:
    #0 0x4294897 in operator delete(void*, unsigned long) ../../.././libsanitizer/asan/asan_new_delete.cpp:172
    #1 0x4ab25ee in __gnu_cxx::new_allocator<std::_List_node<starrocks::MemTracker*> >::deallocate(std::_List_node<starrocks::MemTracker*>*, unsigned long) /usr/include/c++/10.3.0/ext/new_allocator.h:133
    #2 0x4ab11b1 in std::allocator_traits<std::allocator<std::_List_node<starrocks::MemTracker*> > >::deallocate(std::allocator<std::_List_node<starrocks::MemTracker*> >&, std::_List_node<starrocks::MemTracker*>*, unsigned long) /usr/include/c++/10.3.0/bits/alloc_traits.h:492
    #3 0x4aaf4ab in std::__cxx11::_List_base<starrocks::MemTracker*, std::allocator<starrocks::MemTracker*> >::_M_put_node(std::_List_node<starrocks::MemTracker*>*) /usr/include/c++/10.3.0/bits/stl_list.h:446
    #4 0x4aae748 in std::__cxx11::_List_base<starrocks::MemTracker*, std::allocator<starrocks::MemTracker*> >::_M_clear() /usr/include/c++/10.3.0/bits/list.tcc:81
    #5 0x4aad641 in std::__cxx11::_List_base<starrocks::MemTracker*, std::allocator<starrocks::MemTracker*> >::~_List_base() /usr/include/c++/10.3.0/bits/stl_list.h:499
    #6 0x4aac3c1 in std::__cxx11::list<starrocks::MemTracker*, std::allocator<starrocks::MemTracker*> >::~list() /usr/include/c++/10.3.0/bits/stl_list.h:827
    #7 0x4aa454f in starrocks::MemTracker::~MemTracker() /root/starrocks/be/src/runtime/mem_tracker.cpp:97
    #8 0x5411632 in starrocks::ExecEnv::_destroy() /root/starrocks/be/src/runtime/exec_env.cpp:438
    #9 0x5411ae9 in starrocks::ExecEnv::destroy(starrocks::ExecEnv*) /root/starrocks/be/src/runtime/exec_env.cpp:477
    #10 0x42d4e0a in main /root/starrocks/be/src/service/starrocks_main.cpp:301
    #11 0x7f9c16acc504 in __libc_start_main (/lib64/libc.so.6+0x22504)

previously allocated by thread T364 here:
    #0 0x4293a77 in operator new(unsigned long) ../../.././libsanitizer/asan/asan_new_delete.cpp:99

Thread T364 created by T0 here:
    #0 0x423d772 in __interceptor_pthread_create ../../.././libsanitizer/asan/asan_interceptors.cpp:214
    #1 0x9f5874c in bthread::TaskControl::init(int) /var/local/thirdparty/src/incubator-brpc-0.9.7/src/bthread/task_control.cpp:165
    #2 0x9f4f5e1 in bthread::get_or_new_task_control() /var/local/thirdparty/src/incubator-brpc-0.9.7/src/bthread/bthread.cpp:91
    #3 0x9f4ebcc in bthread::start_from_non_worker(unsigned long*, bthread_attr_t const*, void* (*)(void*), void*) /var/local/thirdparty/src/incubator-brpc-0.9.7/src/bthread/bthread.cpp:128
    #4 0x9f4ebcc in bthread_start_background /var/local/thirdparty/src/incubator-brpc-0.9.7/src/bthread/bthread.cpp:193
    #5 0x9fa1cfe in GlobalInitializeOrDieImpl /var/local/thirdparty/src/incubator-brpc-0.9.7/src/brpc/global.cpp:604
    #6 0x7f9c1758c1ca in __pthread_once_slow (/lib64/libpthread.so.0+0x61ca)

SUMMARY: AddressSanitizer: heap-use-after-free /usr/include/c++/10.3.0/bits/list.tcc:157 in std::__cxx11::list<starrocks::MemTracker*, std::allocator<starrocks::MemTracker*> >::erase(std::_List_const_iterator<starrocks::MemTracker*>)
Shadow bytes around the buggy address:
  0x0c0680188a80: fa fa fa fa 00 00 01 fa fa fa fa fa fa fa fa fa
  0x0c0680188a90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0680188aa0: fa fa fa fa fa fa fa fa 00 00 00 00 fa fa fa fa
  0x0c0680188ab0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0680188ac0: 00 00 00 fa fa fa 00 00 00 fa fa fa fa fa fa fa
=>0x0c0680188ad0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fd]fd
  0x0c0680188ae0: fd fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0680188af0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0680188b00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0680188b10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0680188b20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==5470==ABORTING

StarRocks version (Required)

stdpain commented 2 years ago

another graceful exit ASAN crash:

=================================================================
==163680==ERROR: AddressSanitizer: heap-use-after-free on address 0x614000001668 at pc 0x0000046ce4bb bp 0x7f489c7f05f0 sp 0x7f489c7f05e8
READ of size 8 at 0x614000001668 thread T648
    #0 0x46ce4ba in starrocks::DataDir::path_hash() const /home/stdpain/SR/be/src/storage/data_dir.h:61
    #1 0x476f5e7 in starrocks::TabletManager::find_best_tablet_to_compaction(starrocks::CompactionType, starrocks::DataDir*) /home/stdpain/SR/be/src/storage/tablet_manager.cpp:554
    #2 0x46b779f in starrocks::StorageEngine::_perform_cumulative_compaction(starrocks::DataDir*) /home/stdpain/SR/be/src/storage/storage_engine.cpp:570
    #3 0x4692a1f in starrocks::StorageEngine::_cumulative_compaction_thread_callback(void*, starrocks::DataDir*) /home/stdpain/SR/be/src/storage/olap_server.cpp:310
    #4 0x468dfed in operator() /home/stdpain/SR/be/src/storage/olap_server.cpp:110
    #5 0x469c295 in __invoke_impl<void, starrocks::StorageEngine::start_bg_threads()::<lambda()> > /home/disk1/doris-deps/toolchain/installed/gcc-9.2.0/include/c++/9.2.0/bits/invoke.h:60
    #6 0x469bf2c in __invoke<starrocks::StorageEngine::start_bg_threads()::<lambda()> > /home/disk1/doris-deps/toolchain/installed/gcc-9.2.0/include/c++/9.2.0/bits/invoke.h:95
    #7 0x469bc85 in _M_invoke<0> /home/disk1/doris-deps/toolchain/installed/gcc-9.2.0/include/c++/9.2.0/thread:244
    #8 0x469bb0f in operator() /home/disk1/doris-deps/toolchain/installed/gcc-9.2.0/include/c++/9.2.0/thread:251
    #9 0x469b9cb in _M_run /home/disk1/doris-deps/toolchain/installed/gcc-9.2.0/include/c++/9.2.0/thread:195
    #10 0xbc0513f in execute_native_thread_routine ../../../../../libstdc++-v3/src/c++11/thread.cc:80
    #11 0x7f49da04dea4 in start_thread (/lib64/libpthread.so.0+0x7ea4)
    #12 0x7f49d9668b0c in clone (/lib64/libc.so.6+0xfeb0c)