https://clickhouse-test-reports.s3.yandex.net/29202/dd8671540aeebef1fffba215e49e1c5439d03bcb/stress_test_(memory).html#fail1

```
==519==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x32f51702 in int std::__1::__cxx_atomic_load<int>(std::__1::__cxx_atomic_base_impl<int> const*, std::__1::memory_order) obj-x86_64-linux-gnu/../contrib/libcxx/include/atomic:1006:12
    #1 0x32f51702 in std::__1::__atomic_base<int, false>::load(std::__1::memory_order) const obj-x86_64-linux-gnu/../contrib/libcxx/include/atomic:1615:17
    #2 0x32f51702 in std::__1::__atomic_base<int, false>::operator int() const obj-x86_64-linux-gnu/../contrib/libcxx/include/atomic:1619:53
    #3 0x32f51702 in DB::ActionBlocker::isCancelled() const obj-x86_64-linux-gnu/../src/Common/ActionBlocker.h:18:39
    #4 0x32f51702 in DB::MergeTask::ExecuteAndFinalizeHorizontalPart::executeImpl() obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTask.cpp:332:37
    #5 0x32f75db3 in DB::MergeTask::ExecuteAndFinalizeHorizontalPart::subtasks::'lambda0'()::operator()() const obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTask.h:209:32
    #6 0x32f75db3 in decltype(std::__1::forward<DB::MergeTask::ExecuteAndFinalizeHorizontalPart::subtasks::'lambda0'()&>(fp)()) std::__1::__invoke<DB::MergeTask::ExecuteAndFinalizeHorizontalPart::subtasks::'lambda0'()&>(DB::MergeTask::ExecuteAndFinalizeHorizontalPart::subtasks::'lambda0'()&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #7 0x32f75db3 in bool std::__1::__invoke_void_return_wrapper<bool>::__call<DB::MergeTask::ExecuteAndFinalizeHorizontalPart::subtasks::'lambda0'()&>(DB::MergeTask::ExecuteAndFinalizeHorizontalPart::subtasks::'lambda0'()&) obj-x86_64-linux-gnu/../contrib/libcxx/include/__functional_base:317:16
    #8 0x32f75db3 in std::__1::__function::__default_alloc_func<DB::MergeTask::ExecuteAndFinalizeHorizontalPart::subtasks::'lambda0'(), bool ()>::operator()() obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:1608:12
    #9 0x32f75db3 in bool std::__1::__function::__policy_invoker<bool ()>::__call_impl<std::__1::__function::__default_alloc_func<DB::MergeTask::ExecuteAndFinalizeHorizontalPart::subtasks::'lambda0'(), bool ()> >(std::__1::__function::__policy_storage const*) obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2089:16
    #10 0x32f4ffd9 in std::__1::__function::__policy_func<bool ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
    #11 0x32f4ffd9 in std::__1::function<bool ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
    #12 0x32f4ffd9 in DB::MergeTask::ExecuteAndFinalizeHorizontalPart::execute() obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTask.cpp:292:9
    #13 0x32f5f72d in DB::MergeTask::execute() obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTask.cpp:664:29
    #14 0x33810e2c in DB::MergePlainMergeTreeTask::executeStep() obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergePlainMergeTreeTask.cpp:47:33
    #15 0x32fe51da in DB::MergeTreeBackgroundExecutor::routine(std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData>) obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTreeBackgroundExecutor.cpp:99:42
    #16 0x32fe6d4d in DB::MergeTreeBackgroundExecutor::threadFunction() obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTreeBackgroundExecutor.cpp:179:13
    #17 0x2f278be8 in DB::MergeTreeBackgroundExecutor::MergeTreeBackgroundExecutor(DB::MergeTreeBackgroundExecutor::Type, unsigned long, unsigned long, unsigned long)::'lambda'()::operator()() const obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTreeBackgroundExecutor.h:82:50
    #18 0x2f278be8 in decltype(std::__1::forward<DB::MergeTreeBackgroundExecutor::MergeTreeBackgroundExecutor(DB::MergeTreeBackgroundExecutor::Type, unsigned long, unsigned long, unsigned long)::'lambda'()&>(fp)()) std::__1::__invoke<DB::MergeTreeBackgroundExecutor::MergeTreeBackgroundExecutor(DB::MergeTreeBackgroundExecutor::Type, unsigned long, unsigned long, unsigned long)::'lambda'()&>(DB::MergeTreeBackgroundExecutor::MergeTreeBackgroundExecutor(DB::MergeTreeBackgroundExecutor::Type, unsigned long, unsigned long, unsigned long)::'lambda'()&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #19 0x2f278be8 in void std::__1::__invoke_void_return_wrapper<void>::__call<DB::MergeTreeBackgroundExecutor::MergeTreeBackgroundExecutor(DB::MergeTreeBackgroundExecutor::Type, unsigned long, unsigned long, unsigned long)::'lambda'()&>(DB::MergeTreeBackgroundExecutor::MergeTreeBackgroundExecutor(DB::MergeTreeBackgroundExecutor::Type, unsigned long, unsigned long, unsigned long)::'lambda'()&) obj-x86_64-linux-gnu/../contrib/libcxx/include/__functional_base:348:9
    #20 0x2f278be8 in std::__1::__function::__default_alloc_func<DB::MergeTreeBackgroundExecutor::MergeTreeBackgroundExecutor(DB::MergeTreeBackgroundExecutor::Type, unsigned long, unsigned long, unsigned long)::'lambda'(), void ()>::operator()() obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:1608:12
    #21 0x2f278be8 in void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<DB::MergeTreeBackgroundExecutor::MergeTreeBackgroundExecutor(DB::MergeTreeBackgroundExecutor::Type, unsigned long, unsigned long, unsigned long)::'lambda'(), void ()> >(std::__1::__function::__policy_storage const*) obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2089:16
    #22 0x9c75351 in std::__1::__function::__policy_func<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
    #23 0x9c75351 in std::__1::function<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
    #24 0x9c75351 in ThreadPoolImpl<ThreadFromGlobalPool>::worker(std::__1::__list_iterator<ThreadFromGlobalPool, void*>) obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:274:17
    #25 0x9c7f44e in void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()::operator()() const obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:139:73
    #26 0x9c7f44e in decltype(std::__1::forward<void>(fp)()) std::__1::__invoke_constexpr<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()&>(void&&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3682:1
    #27 0x9c7f44e in decltype(auto) std::__1::__apply_tuple_impl<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()&, std::__1::tuple<>&>(void&&, std::__1::tuple<>&, std::__1::__tuple_indices<>) obj-x86_64-linux-gnu/../contrib/libcxx/include/tuple:1415:1
    #28 0x9c7f44e in decltype(auto) std::__1::apply<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()&, std::__1::tuple<>&>(void&&, std::__1::tuple<>&) obj-x86_64-linux-gnu/../contrib/libcxx/include/tuple:1424:1
    #29 0x9c7f44e in ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&)::'lambda'()::operator()() obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:188:13
    #30 0x9c7eee8 in decltype(std::__1::forward<void>(fp)()) std::__1::__invoke<ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&)::'lambda'()&>(void&&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #31 0x9c7eee8 in void std::__1::__invoke_void_return_wrapper<void>::__call<ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&)::'lambda'()&>(ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&)::'lambda'()&) obj-x86_64-linux-gnu/../contrib/libcxx/include/__functional_base:348:9
    #32 0x9c7eee8 in std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&)::'lambda'(), void ()>::operator()() obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:1608:12
    #33 0x9c7eee8 in void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&)::'lambda'(), void ()> >(std::__1::__function::__policy_storage const*) obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2089:16
    #34 0x9c6df7c in std::__1::__function::__policy_func<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
    #35 0x9c6df7c in std::__1::function<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
    #36 0x9c6df7c in ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:274:17
    #37 0x9c790e0 in void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()::operator()() const obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:139:73
    #38 0x9c790e0 in decltype(std::__1::forward<void>(fp)()) std::__1::__invoke<void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #39 0x9c790e0 in void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(std::__1::tuple<void, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>&, std::__1::__tuple_indices<>) obj-x86_64-linux-gnu/../contrib/libcxx/include/thread:280:5
    #40 0x9c790e0 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()> >(void*) obj-x86_64-linux-gnu/../contrib/libcxx/include/thread:291:5
    #41 0x7f467e947608 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x9608)
    #42 0x7f467e86e292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)

  Uninitialized value was created by a heap deallocation
    #0 0x9aff099 in operator delete(void*, unsigned long) (/usr/bin/clickhouse+0x9aff099)
    #1 0x337947ac in std::__1::default_delete<DB::StorageMergeTree>::operator()(DB::StorageMergeTree*) const obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:1397:5
    #2 0x337947ac in std::__1::__shared_ptr_pointer<DB::StorageMergeTree*, std::__1::shared_ptr<DB::StorageMergeTree>::__shared_ptr_default_delete<DB::StorageMergeTree, DB::StorageMergeTree>, std::__1::allocator<DB::StorageMergeTree> >::__on_zero_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2565:5
    #3 0x2f39b5ef in std::__1::__shared_count::__release_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2475:9
    #4 0x2f39b5ef in std::__1::__shared_weak_count::__release_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2517:27
    #5 0x2f39b5ef in std::__1::shared_ptr<DB::IStorage>::~shared_ptr() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:3212:19
    #6 0x2f39b5ef in DB::DatabaseCatalog::TableMarkedAsDropped::~TableMarkedAsDropped() obj-x86_64-linux-gnu/../src/Interpreters/DatabaseCatalog.h:237:12
    #7 0x2f391d34 in DB::DatabaseCatalog::dropTableDataTask() obj-x86_64-linux-gnu/../src/Interpreters/DatabaseCatalog.cpp:897:1
    #8 0x2f399928 in DB::DatabaseCatalog::loadDatabases()::$_2::operator()() const obj-x86_64-linux-gnu/../src/Interpreters/DatabaseCatalog.cpp:150:102
    #9 0x2f399928 in decltype(std::__1::forward<DB::DatabaseCatalog::loadDatabases()::$_2&>(fp)()) std::__1::__invoke<DB::DatabaseCatalog::loadDatabases()::$_2&>(DB::DatabaseCatalog::loadDatabases()::$_2&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #10 0x2f399928 in void std::__1::__invoke_void_return_wrapper<void>::__call<DB::DatabaseCatalog::loadDatabases()::$_2&>(DB::DatabaseCatalog::loadDatabases()::$_2&) obj-x86_64-linux-gnu/../contrib/libcxx/include/__functional_base:348:9
    #11 0x2f399928 in std::__1::__function::__default_alloc_func<DB::DatabaseCatalog::loadDatabases()::$_2, void ()>::operator()() obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:1608:12
    #12 0x2f399928 in void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<DB::DatabaseCatalog::loadDatabases()::$_2, void ()> >(std::__1::__function::__policy_storage const*) obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2089:16
    #13 0x2f2e2365 in std::__1::__function::__policy_func<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
    #14 0x2f2e2365 in std::__1::function<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
    #15 0x2f2e2365 in DB::BackgroundSchedulePoolTaskInfo::execute() obj-x86_64-linux-gnu/../src/Core/BackgroundSchedulePool.cpp:106:5
    #16 0x2f2e8e98 in DB::TaskNotification::execute() obj-x86_64-linux-gnu/../src/Core/BackgroundSchedulePool.cpp:19:28
    #17 0x2f2e8e98 in DB::BackgroundSchedulePool::threadFunction() obj-x86_64-linux-gnu/../src/Core/BackgroundSchedulePool.cpp:265:31
    #18 0x2f2eb20f in DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1::operator()() const obj-x86_64-linux-gnu/../src/Core/BackgroundSchedulePool.cpp:161:48
    #19 0x2f2eb20f in decltype(std::__1::forward<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&>(fp)()) std::__1::__invoke_constexpr<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3682:1
    #20 0x2f2eb20f in decltype(auto) std::__1::__apply_tuple_impl<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&, std::__1::tuple<>&>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&, std::__1::tuple<>&, std::__1::__tuple_indices<>) obj-x86_64-linux-gnu/../contrib/libcxx/include/tuple:1415:1
    #21 0x2f2eb20f in decltype(auto) std::__1::apply<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&, std::__1::tuple<>&>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&, std::__1::tuple<>&) obj-x86_64-linux-gnu/../contrib/libcxx/include/tuple:1424:1
    #22 0x2f2eb20f in ThreadFromGlobalPool::ThreadFromGlobalPool<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&)::'lambda'()::operator()() obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:188:13
    #23 0x2f2eb20f in decltype(std::__1::forward<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(fp)()) std::__1::__invoke<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&)::'lambda'()&>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #24 0x2f2eb20f in void std::__1::__invoke_void_return_wrapper<void>::__call<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&)::'lambda'()&>(ThreadFromGlobalPool::ThreadFromGlobalPool<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&)::'lambda'()&) obj-x86_64-linux-gnu/../contrib/libcxx/include/__functional_base:348:9
    #25 0x2f2eb20f in std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&)::'lambda'(), void ()>::operator()() obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:1608:12
    #26 0x2f2eb20f in void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&)::'lambda'(), void ()> >(std::__1::__function::__policy_storage const*) obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2089:16
    #27 0x9c6df7c in std::__1::__function::__policy_func<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
    #28 0x9c6df7c in std::__1::function<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
    #29 0x9c6df7c in ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:274:17
    #30 0x9c790e0 in void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()::operator()() const obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:139:73
    #31 0x9c790e0 in decltype(std::__1::forward<void>(fp)()) std::__1::__invoke<void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #32 0x9c790e0 in void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(std::__1::tuple<void, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>&, std::__1::__tuple_indices<>) obj-x86_64-linux-gnu/../contrib/libcxx/include/thread:280:5
    #33 0x9c790e0 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()> >(void*) obj-x86_64-linux-gnu/../contrib/libcxx/include/thread:291:5
    #34 0x7f467e947608 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x9608)

SUMMARY: MemorySanitizer: use-of-uninitialized-value obj-x86_64-linux-gnu/../contrib/libcxx/include/atomic:1006:12 in int std::__1::__cxx_atomic_load<int>(std::__1::__cxx_atomic_base_impl<int> const*, std::__1::memory_order)
Exiting
==519==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x3220d731 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../contrib/libcxx/include/string:1902:9
    #1 0x3220d731 in DB::StorageID::StorageID(DB::StorageID const&) obj-x86_64-linux-gnu/../src/Interpreters/StorageID.h:32:8
    #2 0x3220d731 in DB::IStorage::getStorageID() const obj-x86_64-linux-gnu/../src/Storages/IStorage.cpp:162:12
    #3 0x33810ab7 in DB::MergePlainMergeTreeTask::getStorageID() obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergePlainMergeTreeTask.cpp:18:20
    #4 0x32fe3142 in bool DB::MergeTreeBackgroundExecutor::removeTasksCorrespondingToStorage(DB::StorageID)::$_1::operator()<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData> >(std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData>) const obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTreeBackgroundExecutor.cpp:71:58
    #5 0x32fe3142 in std::__1::back_insert_iterator<std::__1::vector<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData>, std::__1::allocator<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData> > > > std::__1::copy_if<boost::cb_details::iterator<boost::circular_buffer<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData>, std::__1::allocator<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData> > >, boost::cb_details::nonconst_traits<boost::cb_details::allocator_traits<std::__1::allocator<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData> > > > >, std::__1::back_insert_iterator<std::__1::vector<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData>, std::__1::allocator<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData> > > >, DB::MergeTreeBackgroundExecutor::removeTasksCorrespondingToStorage(DB::StorageID)::$_1>(boost::cb_details::iterator<boost::circular_buffer<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData>, std::__1::allocator<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData> > >, boost::cb_details::nonconst_traits<boost::cb_details::allocator_traits<std::__1::allocator<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData> > > > >, boost::cb_details::iterator<boost::circular_buffer<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData>, std::__1::allocator<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData> > >, boost::cb_details::nonconst_traits<boost::cb_details::allocator_traits<std::__1::allocator<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData> > > > >, std::__1::back_insert_iterator<std::__1::vector<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData>, std::__1::allocator<std::__1::shared_ptr<DB::MergeTreeBackgroundExecutor::TaskRuntimeData> > > >, DB::MergeTreeBackgroundExecutor::removeTasksCorrespondingToStorage(DB::StorageID)::$_1) obj-x86_64-linux-gnu/../contrib/libcxx/include/algorithm:1809:13
    #6 0x32fe3142 in DB::MergeTreeBackgroundExecutor::removeTasksCorrespondingToStorage(DB::StorageID) obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTreeBackgroundExecutor.cpp:70:9
    #7 0x32d7a935 in DB::BackgroundJobsAssignee::finish() obj-x86_64-linux-gnu/../src/Storages/MergeTree/BackgroundJobsAssignee.cpp:104:49
    #8 0x3379a84d in DB::StorageMergeTree::shutdown() obj-x86_64-linux-gnu/../src/Storages/StorageMergeTree.cpp:160:36
    #9 0x3033e30c in DB::IStorage::flushAndShutdown() obj-x86_64-linux-gnu/../src/Storages/IStorage.h:485:9
    #10 0x3033e30c in DB::InterpreterDropQuery::executeToTableImpl(DB::ASTDropQuery&, std::__1::shared_ptr<DB::IDatabase>&, StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag>&) obj-x86_64-linux-gnu/../src/Interpreters/InterpreterDropQuery.cpp:222:20
    #11 0x30339f63 in DB::InterpreterDropQuery::executeToTable(DB::ASTDropQuery&) obj-x86_64-linux-gnu/../src/Interpreters/InterpreterDropQuery.cpp:85:16
    #12 0x303387ef in DB::InterpreterDropQuery::execute() obj-x86_64-linux-gnu/../src/Interpreters/InterpreterDropQuery.cpp:62:16
    #13 0x3186f5af in DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:633:32
    #14 0x31866710 in DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:993:30
    #15 0x33b306c4 in DB::TCPHandler::runImpl() obj-x86_64-linux-gnu/../src/Server/TCPHandler.cpp:290:24
    #16 0x33b678ab in DB::TCPHandler::run() obj-x86_64-linux-gnu/../src/Server/TCPHandler.cpp:1661:9
    #17 0x3ec011fb in Poco::Net::TCPServerConnection::start() obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerConnection.cpp:43:3
    #18 0x3ec02531 in Poco::Net::TCPServerDispatcher::run() obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerDispatcher.cpp:115:20
    #19 0x3f036191 in Poco::PooledThread::run() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/ThreadPool.cpp:199:14
    #20 0x3f0317e8 in Poco::(anonymous namespace)::RunnableHolder::run() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread.cpp:55:11
    #21 0x3f02db95 in Poco::ThreadImpl::runnableEntry(void*) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread_POSIX.cpp:345:27
    #22 0x7f467e947608 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x9608)
    #23 0x7f467e86e292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)

  Uninitialized value was created by a heap deallocation
    #0 0x9aff099 in operator delete(void*, unsigned long) (/usr/bin/clickhouse+0x9aff099)
    #1 0x337947ac in std::__1::default_delete<DB::StorageMergeTree>::operator()(DB::StorageMergeTree*) const obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:1397:5
    #2 0x337947ac in std::__1::__shared_ptr_pointer<DB::StorageMergeTree*, std::__1::shared_ptr<DB::StorageMergeTree>::__shared_ptr_default_delete<DB::StorageMergeTree, DB::StorageMergeTree>, std::__1::allocator<DB::StorageMergeTree> >::__on_zero_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2565:5
    #3 0x2f39b5ef in std::__1::__shared_count::__release_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2475:9
    #4 0x2f39b5ef in std::__1::__shared_weak_count::__release_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2517:27
    #5 0x2f39b5ef in std::__1::shared_ptr<DB::IStorage>::~shared_ptr() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:3212:19
    #6 0x2f39b5ef in DB::DatabaseCatalog::TableMarkedAsDropped::~TableMarkedAsDropped() obj-x86_64-linux-gnu/../src/Interpreters/DatabaseCatalog.h:237:12
    #7 0x2f391d34 in DB::DatabaseCatalog::dropTableDataTask() obj-x86_64-linux-gnu/../src/Interpreters/DatabaseCatalog.cpp:897:1
    #8 0x2f399928 in DB::DatabaseCatalog::loadDatabases()::$_2::operator()() const obj-x86_64-linux-gnu/../src/Interpreters/DatabaseCatalog.cpp:150:102
    #9 0x2f399928 in decltype(std::__1::forward<DB::DatabaseCatalog::loadDatabases()::$_2&>(fp)()) std::__1::__invoke<DB::DatabaseCatalog::loadDatabases()::$_2&>(DB::DatabaseCatalog::loadDatabases()::$_2&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #10 0x2f399928 in void std::__1::__invoke_void_return_wrapper<void>::__call<DB::DatabaseCatalog::loadDatabases()::$_2&>(DB::DatabaseCatalog::loadDatabases()::$_2&) obj-x86_64-linux-gnu/../contrib/libcxx/include/__functional_base:348:9
    #11 0x2f399928 in std::__1::__function::__default_alloc_func<DB::DatabaseCatalog::loadDatabases()::$_2, void ()>::operator()() obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:1608:12
    #12 0x2f399928 in void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<DB::DatabaseCatalog::loadDatabases()::$_2, void ()> >(std::__1::__function::__policy_storage const*) obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2089:16
    #13 0x2f2e2365 in std::__1::__function::__policy_func<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
    #14 0x2f2e2365 in std::__1::function<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
    #15 0x2f2e2365 in DB::BackgroundSchedulePoolTaskInfo::execute() obj-x86_64-linux-gnu/../src/Core/BackgroundSchedulePool.cpp:106:5
    #16 0x2f2e8e98 in DB::TaskNotification::execute() obj-x86_64-linux-gnu/../src/Core/BackgroundSchedulePool.cpp:19:28
    #17 0x2f2e8e98 in DB::BackgroundSchedulePool::threadFunction() obj-x86_64-linux-gnu/../src/Core/BackgroundSchedulePool.cpp:265:31
    #18 0x2f2eb20f in DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1::operator()() const obj-x86_64-linux-gnu/../src/Core/BackgroundSchedulePool.cpp:161:48
    #19 0x2f2eb20f in decltype(std::__1::forward<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&>(fp)()) std::__1::__invoke_constexpr<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3682:1
    #20 0x2f2eb20f in decltype(auto) std::__1::__apply_tuple_impl<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&, std::__1::tuple<>&>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&, std::__1::tuple<>&, std::__1::__tuple_indices<>) obj-x86_64-linux-gnu/../contrib/libcxx/include/tuple:1415:1
    #21 0x2f2eb20f in decltype(auto) std::__1::apply<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&, std::__1::tuple<>&>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&, std::__1::tuple<>&) obj-x86_64-linux-gnu/../contrib/libcxx/include/tuple:1424:1
    #22 0x2f2eb20f in ThreadFromGlobalPool::ThreadFromGlobalPool<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&)::'lambda'()::operator()() obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:188:13
    #23 0x2f2eb20f in decltype(std::__1::forward<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(fp)()) std::__1::__invoke<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&)::'lambda'()&>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #24 0x2f2eb20f in void std::__1::__invoke_void_return_wrapper<void>::__call<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&)::'lambda'()&>(ThreadFromGlobalPool::ThreadFromGlobalPool<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&)::'lambda'()&) obj-x86_64-linux-gnu/../contrib/libcxx/include/__functional_base:348:9
    #25 0x2f2eb20f in std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&)::'lambda'(), void ()>::operator()() obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:1608:12
    #26 0x2f2eb20f in void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1>(DB::BackgroundSchedulePool::BackgroundSchedulePool(unsigned long, unsigned long, char const*)::$_1&&)::'lambda'(), void ()> >(std::__1::__function::__policy_storage const*) obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2089:16
    #27 0x9c6df7c in std::__1::__function::__policy_func<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
    #28 0x9c6df7c in std::__1::function<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
    #29 0x9c6df7c in ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:274:17
    #30 0x9c790e0 in void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()::operator()() const obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:139:73
    #31 0x9c790e0 in decltype(std::__1::forward<void>(fp)()) std::__1::__invoke<void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #32 0x9c790e0 in void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(std::__1::tuple<void, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>&, std::__1::__tuple_indices<>) obj-x86_64-linux-gnu/../contrib/libcxx/include/thread:280:5
    #33 0x9c790e0 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()> >(void*) obj-x86_64-linux-gnu/../contrib/libcxx/include/thread:291:5
    #34 0x7f467e947608 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x9608)

SUMMARY: MemorySanitizer: use-of-uninitialized-value obj-x86_64-linux-gnu/../contrib/libcxx/include/string:1902:9 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Exiting
```

cc: @nikitamikhaylov 
has_tasks.notify_one();
        return;
    }
    {
        std::lock_guard guard(mutex);
        erase_from_active();
        has_tasks.notify_one();
        try
        {
            ALLOW_ALLOCATIONS_IN_SCOPE;
            
            
            
            item->task->onCompleted();
        }
        catch (...)
        {
            tryLogCurrentException(__PRETTY_FUNCTION__);
        }
        
        
        
        
        
        item->task.reset();
    }
}
void MergeTreeBackgroundExecutor::threadFunction()
{
    setThreadName(name.c_str());