Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThreadSanitizer reports data race in DeltaIndexManager::refreshRef. #4405

Closed
JinheLin opened this issue Mar 24, 2022 · 0 comments · Fixed by #4459
Closed

ThreadSanitizer reports data race in DeltaIndexManager::refreshRef. #4405

JinheLin opened this issue Mar 24, 2022 · 0 comments · Fixed by #4459

Comments

@JinheLin
Copy link
Contributor

JinheLin commented Mar 24, 2022

Bug Report

ThreadSanitizer reports data race in DeltaIndexManager::refreshRef.

Following the code, it seems that current_size is not thread-safe?

[2022-03-23T18:37:47.176Z] WARNING: ThreadSanitizer: data race (pid=31885)
[2022-03-23T18:37:47.176Z]   Write of size 8 at 0x7b280001be98 by main thread (mutexes: write M836116092559670960):
[2022-03-23T18:37:47.176Z]     #0 DB::DM::DeltaIndexManager::refreshRef(std::__1::shared_ptr<DB::DM::DeltaIndex> const&) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/DeltaIndexManager.cpp:86:26 (gtests_dbms+0xe1ef767)
[2022-03-23T18:37:47.176Z]     #1 DB::DM::Segment::getReadInfo(DB::DM::DMContext const&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > const&, std::__1::shared_ptr<DB::DM::SegmentSnapshot> const&, std::__1::vector<DB::DM::RowKeyRange, std::__1::allocator<DB::DM::RowKeyRange> > const&, unsigned long) const /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/Segment.cpp:1356:18 (gtests_dbms+0xe24d11b)
[2022-03-23T18:37:47.176Z]     #2 DB::DM::Segment::getInputStream(DB::DM::DMContext const&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > const&, std::__1::shared_ptr<DB::DM::SegmentSnapshot> const&, std::__1::vector<DB::DM::RowKeyRange, std::__1::allocator<DB::DM::RowKeyRange> > const&, std::__1::shared_ptr<DB::DM::RSOperator> const&, unsigned long, unsigned long) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/Segment.cpp:369:22 (gtests_dbms+0xe24b7f8)
[2022-03-23T18:37:47.176Z]     #3 DB::DM::DMSegmentThreadInputStream::readImpl(DB::PODArray<unsigned char, 4096ul, Allocator<false>, 15ul, 16ul>*&, bool) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/DMSegmentThreadInputStream.h:111:47 (gtests_dbms+0xe22d53b)
[2022-03-23T18:37:47.176Z]     #4 DB::DM::DMSegmentThreadInputStream::readImpl() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/DMSegmentThreadInputStream.h:85:16 (gtests_dbms+0xe22c956)
[2022-03-23T18:37:47.177Z]     #5 DB::IProfilingBlockInputStream::read(DB::PODArray<unsigned char, 4096ul, Allocator<false>, 15ul, 16ul>*&, bool) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/DataStreams/IProfilingBlockInputStream.cpp:75:19 (gtests_dbms+0xc7ff788)
[2022-03-23T18:37:47.177Z]     #6 DB::IProfilingBlockInputStream::read() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/DataStreams/IProfilingBlockInputStream.cpp:43:12 (gtests_dbms+0xc7ff1ca)
[2022-03-23T18:37:47.177Z]     #7 DB::DM::tests::DeltaMergeStoreRWTest_Split_Test::TestBody() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/tests/gtest_dm_delta_merge_store.cpp:1471:38 (gtests_dbms+0x690ccdc)
[2022-03-23T18:37:47.177Z]     #8 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2401:10 (gtests_dbms+0xc7d4155)
[2022-03-23T18:37:47.177Z]     #9 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2437:14 (gtests_dbms+0xc7d4155)
[2022-03-23T18:37:47.177Z]     #10 testing::Test::Run() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2473:5 (gtests_dbms+0xc7b3e75)
[2022-03-23T18:37:47.177Z]     #11 testing::TestInfo::Run() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2655:11 (gtests_dbms+0xc7b5641)
[2022-03-23T18:37:47.177Z]     #12 testing::TestCase::Run() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2773:28 (gtests_dbms+0xc7b62fd)
[2022-03-23T18:37:47.177Z]     #13 testing::internal::UnitTestImpl::RunAllTests() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:4673:43 (gtests_dbms+0xc7c1680)
[2022-03-23T18:37:47.177Z]     #14 bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2401:10 (gtests_dbms+0xc7d5215)
[2022-03-23T18:37:47.177Z]     #15 bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2437:14 (gtests_dbms+0xc7d5215)
[2022-03-23T18:37:47.177Z]     #16 testing::UnitTest::Run() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:4281:10 (gtests_dbms+0xc7c0b03)
[2022-03-23T18:37:47.177Z]     #17 RUN_ALL_TESTS() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/include/gtest/gtest.h:2237:46 (gtests_dbms+0x6e169f7)
[2022-03-23T18:37:47.177Z]     #18 main /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/TestUtils/gtests_dbms_main.cpp:36:16 (gtests_dbms+0x6e169f7)
[2022-03-23T18:37:47.177Z] 
[2022-03-23T18:37:47.177Z]   Previous read of size 8 at 0x7b280001be98 by thread T20:
[2022-03-23T18:37:47.177Z]     #0 DB::DM::DeltaIndexManager::refreshRef(std::__1::shared_ptr<DB::DM::DeltaIndex> const&) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/DeltaIndexManager.cpp:97:65 (gtests_dbms+0xe1ef6b1)
[2022-03-23T18:37:47.177Z]     #1 DB::DM::Segment::getReadInfo(DB::DM::DMContext const&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > const&, std::__1::shared_ptr<DB::DM::SegmentSnapshot> const&, std::__1::vector<DB::DM::RowKeyRange, std::__1::allocator<DB::DM::RowKeyRange> > const&, unsigned long) const /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/Segment.cpp:1356:18 (gtests_dbms+0xe24d11b)
[2022-03-23T18:37:47.177Z]     #2 DB::DM::Segment::prepareMerge(DB::DM::DMContext&, std::__1::shared_ptr<std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > > const&, std::__1::shared_ptr<DB::DM::Segment> const&, std::__1::shared_ptr<DB::DM::SegmentSnapshot> const&, std::__1::shared_ptr<DB::DM::Segment> const&, std::__1::shared_ptr<DB::DM::SegmentSnapshot> const&, DB::DM::WriteBatches&)::$_38::operator()(std::__1::shared_ptr<DB::DM::Segment> const&, std::__1::shared_ptr<DB::DM::SegmentSnapshot> const&) const /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/Segment.cpp:1170:35 (gtests_dbms+0xe25d3ba)
[2022-03-23T18:37:47.177Z]     #3 DB::DM::Segment::prepareMerge(DB::DM::DMContext&, std::__1::shared_ptr<std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > > const&, std::__1::shared_ptr<DB::DM::Segment> const&, std::__1::shared_ptr<DB::DM::SegmentSnapshot> const&, std::__1::shared_ptr<DB::DM::Segment> const&, std::__1::shared_ptr<DB::DM::SegmentSnapshot> const&, DB::DM::WriteBatches&) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/Segment.cpp:1197:24 (gtests_dbms+0xe25b640)
[2022-03-23T18:37:47.177Z]     #4 DB::DM::DeltaMergeStore::segmentMerge(DB::DM::DMContext&, std::__1::shared_ptr<DB::DM::Segment> const&, std::__1::shared_ptr<DB::DM::Segment> const&, bool) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/DeltaMergeStore.cpp:1855:26 (gtests_dbms+0xe2178c0)
[2022-03-23T18:37:47.177Z]     #5 DB::DM::DeltaMergeStore::handleBackgroundTask(bool) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/DeltaMergeStore.cpp:1433:13 (gtests_dbms+0xe213c78)
[2022-03-23T18:37:47.177Z]     #6 DB::DM::DeltaMergeStore::setUpBackgroundTask(std::__1::shared_ptr<DB::DM::DMContext> const&)::$_60::operator()() const /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/DeltaMergeStore.cpp:338:90 (gtests_dbms+0xe2225f8)
[2022-03-23T18:37:47.177Z]     #7 decltype(static_cast<DB::DM::DeltaMergeStore::setUpBackgroundTask(std::__1::shared_ptr<DB::DM::DMContext> const&)::$_60&>(fp)()) std::__1::__invoke<DB::DM::DeltaMergeStore::setUpBackgroundTask(std::__1::shared_ptr<DB::DM::DMContext> const&)::$_60&>(DB::DM::DeltaMergeStore::setUpBackgroundTask(std::__1::shared_ptr<DB::DM::DMContext> const&)::$_60&) /usr/local/bin/../include/c++/v1/type_traits:3918:1 (gtests_dbms+0xe2225f8)
[2022-03-23T18:37:47.177Z]     #8 bool std::__1::__invoke_void_return_wrapper<bool, false>::__call<DB::DM::DeltaMergeStore::setUpBackgroundTask(std::__1::shared_ptr<DB::DM::DMContext> const&)::$_60&>(DB::DM::DeltaMergeStore::setUpBackgroundTask(std::__1::shared_ptr<DB::DM::DMContext> const&)::$_60&) /usr/local/bin/../include/c++/v1/__functional/invoke.h:30:16 (gtests_dbms+0xe2225f8)
[2022-03-23T18:37:47.177Z]     #9 std::__1::__function::__alloc_func<DB::DM::DeltaMergeStore::setUpBackgroundTask(std::__1::shared_ptr<DB::DM::DMContext> const&)::$_60, std::__1::allocator<DB::DM::DeltaMergeStore::setUpBackgroundTask(std::__1::shared_ptr<DB::DM::DMContext> const&)::$_60>, bool ()>::operator()() /usr/local/bin/../include/c++/v1/__functional/function.h:171:16 (gtests_dbms+0xe2225f8)
[2022-03-23T18:37:47.177Z]     #10 std::__1::__function::__func<DB::DM::DeltaMergeStore::setUpBackgroundTask(std::__1::shared_ptr<DB::DM::DMContext> const&)::$_60, std::__1::allocator<DB::DM::DeltaMergeStore::setUpBackgroundTask(std::__1::shared_ptr<DB::DM::DMContext> const&)::$_60>, bool ()>::operator()() /usr/local/bin/../include/c++/v1/__functional/function.h:345:12 (gtests_dbms+0xe2225f8)
[2022-03-23T18:37:47.178Z]     #11 std::__1::__function::__value_func<bool ()>::operator()() const /usr/local/bin/../include/c++/v1/__functional/function.h:498:16 (gtests_dbms+0xe0f7baa)
[2022-03-23T18:37:47.178Z]     #12 std::__1::function<bool ()>::operator()() const /usr/local/bin/../include/c++/v1/__functional/function.h:1175:12 (gtests_dbms+0xe0f7baa)
[2022-03-23T18:37:47.178Z]     #13 DB::BackgroundProcessingPool::threadFunction() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/BackgroundProcessingPool.cpp:225:33 (gtests_dbms+0xe0f7baa)
[2022-03-23T18:37:47.178Z]     #14 DB::BackgroundProcessingPool::BackgroundProcessingPool(int)::$_1::operator()() const /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/BackgroundProcessingPool.cpp:84:39 (gtests_dbms+0xe0f8430)
[2022-03-23T18:37:47.178Z]     #15 decltype(static_cast<DB::BackgroundProcessingPool::BackgroundProcessingPool(int)::$_1>(fp)()) std::__1::__invoke<DB::BackgroundProcessingPool::BackgroundProcessingPool(int)::$_1>(DB::BackgroundProcessingPool::BackgroundProcessingPool(int)::$_1&&) /usr/local/bin/../include/c++/v1/type_traits:3918:1 (gtests_dbms+0xe0f8430)
[2022-03-23T18:37:47.178Z]     #16 void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, DB::BackgroundProcessingPool::BackgroundProcessingPool(int)::$_1>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, DB::BackgroundProcessingPool::BackgroundProcessingPool(int)::$_1>&, std::__1::__tuple_indices<>) /usr/local/bin/../include/c++/v1/thread:280:5 (gtests_dbms+0xe0f8430)
[2022-03-23T18:37:47.178Z]     #17 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, DB::BackgroundProcessingPool::BackgroundProcessingPool(int)::$_1> >(void*) /usr/local/bin/../include/c++/v1/thread:291:5 (gtests_dbms+0xe0f8430)
[2022-03-23T18:37:47.178Z] 
[2022-03-23T18:37:47.178Z]   Location is heap block of size 152 at 0x7b280001be40 allocated by main thread:
[2022-03-23T18:37:47.178Z]     #0 operator new(unsigned long) /llvm-project/compiler-rt/lib/tsan/rtl/tsan_new_delete.cpp:64:3 (gtests_dbms+0x54d2e98)
[2022-03-23T18:37:47.178Z]     #1 void* std::__1::__libcpp_operator_new<unsigned long>(unsigned long) /usr/local/bin/../include/c++/v1/new:235:10 (gtests_dbms+0xd95d5c2)
[2022-03-23T18:37:47.178Z]     #2 std::__1::__libcpp_allocate(unsigned long, unsigned long) /usr/local/bin/../include/c++/v1/new:261:10 (gtests_dbms+0xd95d5c2)
[2022-03-23T18:37:47.178Z]     #3 std::__1::allocator<std::__1::__shared_ptr_emplace<DB::DM::DeltaIndexManager, std::__1::allocator<DB::DM::DeltaIndexManager> > >::allocate(unsigned long) /usr/local/bin/../include/c++/v1/__memory/allocator.h:108:38 (gtests_dbms+0xd95d5c2)
[2022-03-23T18:37:47.178Z]     #4 std::__1::allocator_traits<std::__1::allocator<std::__1::__shared_ptr_emplace<DB::DM::DeltaIndexManager, std::__1::allocator<DB::DM::DeltaIndexManager> > > >::allocate(std::__1::allocator<std::__1::__shared_ptr_emplace<DB::DM::DeltaIndexManager, std::__1::allocator<DB::DM::DeltaIndexManager> > >&, unsigned long) /usr/local/bin/../include/c++/v1/__memory/allocator_traits.h:262:20 (gtests_dbms+0xd95d5c2)
[2022-03-23T18:37:47.178Z]     #5 std::__1::__allocation_guard<std::__1::allocator<std::__1::__shared_ptr_emplace<DB::DM::DeltaIndexManager, std::__1::allocator<DB::DM::DeltaIndexManager> > > >::__allocation_guard<std::__1::allocator<DB::DM::DeltaIndexManager> >(std::__1::allocator<DB::DM::DeltaIndexManager>, unsigned long) /usr/local/bin/../include/c++/v1/__memory/allocation_guard.h:57:18 (gtests_dbms+0xd95d5c2)
[2022-03-23T18:37:47.178Z]     #6 std::__1::shared_ptr<DB::DM::DeltaIndexManager> std::__1::allocate_shared<DB::DM::DeltaIndexManager, std::__1::allocator<DB::DM::DeltaIndexManager>, unsigned long&, void>(std::__1::allocator<DB::DM::DeltaIndexManager> const&, unsigned long&) /usr/local/bin/../include/c++/v1/__memory/shared_ptr.h:1105:48 (gtests_dbms+0xd95d5c2)
[2022-03-23T18:37:47.178Z]     #7 std::__1::shared_ptr<DB::DM::DeltaIndexManager> std::__1::make_shared<DB::DM::DeltaIndexManager, unsigned long&, void>(unsigned long&) /usr/local/bin/../include/c++/v1/__memory/shared_ptr.h:1115:12 (gtests_dbms+0xd95d5c2)
[2022-03-23T18:37:47.178Z]     #8 DB::Context::setDeltaIndexManager(unsigned long) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Interpreters/Context.cpp:1448:35 (gtests_dbms+0xd95d5c2)
[2022-03-23T18:37:47.178Z]     #9 DB::tests::TiFlashTestEnv::initializeGlobalContext(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> > > >, bool) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/TestUtils/TiFlashTestEnv.cpp:79:21 (gtests_dbms+0x6ead80f)
[2022-03-23T18:37:47.178Z]     #10 main /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/TestUtils/gtests_dbms_main.cpp:27:5 (gtests_dbms+0x6e168f6)
[2022-03-23T18:37:47.178Z] 
[2022-03-23T18:37:47.178Z]   Mutex M836116092559670960 is already destroyed.
[2022-03-23T18:37:47.178Z] 
[2022-03-23T18:37:47.178Z]   Thread T20 'BkgPool19' (tid=31908, running) created by main thread at:
[2022-03-23T18:37:47.178Z]     #0 pthread_create /llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:977:3 (gtests_dbms+0x545e2bd)
[2022-03-23T18:37:47.178Z]     #1 std::__1::__libcpp_thread_create(unsigned long*, void* (*)(void*), void*) /usr/local/bin/../include/c++/v1/__threading_support:514:10 (gtests_dbms+0xe0f6e8b)
[2022-03-23T18:37:47.178Z]     #2 std::__1::thread::thread<DB::BackgroundProcessingPool::BackgroundProcessingPool(int)::$_1, void>(DB::BackgroundProcessingPool::BackgroundProcessingPool(int)::$_1&&) /usr/local/bin/../include/c++/v1/thread:307:16 (gtests_dbms+0xe0f6e8b)
[2022-03-23T18:37:47.178Z]     #3 DB::BackgroundProcessingPool::BackgroundProcessingPool(int) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/BackgroundProcessingPool.cpp:84:18 (gtests_dbms+0xe0f6e8b)
[2022-03-23T18:37:47.178Z]     #4 std::__1::__shared_ptr_emplace<DB::BackgroundProcessingPool, std::__1::allocator<DB::BackgroundProcessingPool> >::__shared_ptr_emplace<DB::SettingInt<unsigned long>&>(std::__1::allocator<DB::BackgroundProcessingPool>, DB::SettingInt<unsigned long>&) /usr/local/bin/../include/c++/v1/__memory/shared_ptr.h:298:37 (gtests_dbms+0xd95dcf9)
[2022-03-23T18:37:47.178Z]     #5 std::__1::shared_ptr<DB::BackgroundProcessingPool> std::__1::allocate_shared<DB::BackgroundProcessingPool, std::__1::allocator<DB::BackgroundProcessingPool>, DB::SettingInt<unsigned long>&, void>(std::__1::allocator<DB::BackgroundProcessingPool> const&, DB::SettingInt<unsigned long>&) /usr/local/bin/../include/c++/v1/__memory/shared_ptr.h:1106:55 (gtests_dbms+0xd95dcf9)
[2022-03-23T18:37:47.178Z]     #6 std::__1::shared_ptr<DB::BackgroundProcessingPool> std::__1::make_shared<DB::BackgroundProcessingPool, DB::SettingInt<unsigned long>&, void>(DB::SettingInt<unsigned long>&) /usr/local/bin/../include/c++/v1/__memory/shared_ptr.h:1115:12 (gtests_dbms+0xd95dcf9)
[2022-03-23T18:37:47.178Z]     #7 DB::Context::getBlockableBackgroundPool() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Interpreters/Context.cpp:1481:45 (gtests_dbms+0xd95dcf9)
[2022-03-23T18:37:47.178Z]     #8 DB::DM::DeltaMergeStore::DeltaMergeStore(DB::Context&, bool, 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&, long, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > const&, DB::DM::ColumnDefine const&, bool, unsigned long, DB::DM::DeltaMergeStore::Settings const&) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/DeltaMergeStore.cpp:208:44 (gtests_dbms+0xe1fb8b7)
[2022-03-23T18:37:47.179Z]     #9 std::__1::__shared_ptr_emplace<DB::DM::DeltaMergeStore, std::__1::allocator<DB::DM::DeltaMergeStore> >::__shared_ptr_emplace<DB::Context&, bool, char const (&) [5], char const (&) [22], int, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&, DB::DM::ColumnDefine&, bool&, unsigned long&, DB::DM::DeltaMergeStore::Settings>(std::__1::allocator<DB::DM::DeltaMergeStore>, DB::Context&, bool&&, char const (&) [5], char const (&) [22], int&&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&, DB::DM::ColumnDefine&, bool&, unsigned long&, DB::DM::DeltaMergeStore::Settings&&) /usr/local/bin/../include/c++/v1/__memory/shared_ptr.h:298:37 (gtests_dbms+0x6966a0c)
[2022-03-23T18:37:47.179Z]     #10 std::__1::shared_ptr<DB::DM::DeltaMergeStore> std::__1::allocate_shared<DB::DM::DeltaMergeStore, std::__1::allocator<DB::DM::DeltaMergeStore>, DB::Context&, bool, char const (&) [5], char const (&) [22], int, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&, DB::DM::ColumnDefine&, bool&, unsigned long&, DB::DM::DeltaMergeStore::Settings, void>(std::__1::allocator<DB::DM::DeltaMergeStore> const&, DB::Context&, bool&&, char const (&) [5], char const (&) [22], int&&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&, DB::DM::ColumnDefine&, bool&, unsigned long&, DB::DM::DeltaMergeStore::Settings&&) /usr/local/bin/../include/c++/v1/__memory/shared_ptr.h:1106:55 (gtests_dbms+0x695812e)
[2022-03-23T18:37:47.179Z]     #11 std::__1::shared_ptr<DB::DM::DeltaMergeStore> std::__1::make_shared<DB::DM::DeltaMergeStore, DB::Context&, bool, char const (&) [5], char const (&) [22], int, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&, DB::DM::ColumnDefine&, bool&, unsigned long&, DB::DM::DeltaMergeStore::Settings, void>(DB::Context&, bool&&, char const (&) [5], char const (&) [22], int&&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&, DB::DM::ColumnDefine&, bool&, unsigned long&, DB::DM::DeltaMergeStore::Settings&&) /usr/local/bin/../include/c++/v1/__memory/shared_ptr.h:1115:12 (gtests_dbms+0x695812e)
[2022-03-23T18:37:47.179Z]     #12 DB::DM::tests::DeltaMergeStoreRWTest::reload(std::__1::shared_ptr<std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > > const&, bool, unsigned long) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/tests/gtest_dm_delta_merge_store.cpp:166:32 (gtests_dbms+0x695812e)
[2022-03-23T18:37:47.179Z]     #13 DB::DM::tests::DeltaMergeStoreRWTest::SetUp() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/tests/gtest_dm_delta_merge_store.cpp:151:17 (gtests_dbms+0x695f983)
[2022-03-23T18:37:47.179Z]     #14 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2401:10 (gtests_dbms+0xc7d4155)
[2022-03-23T18:37:47.179Z]     #15 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2437:14 (gtests_dbms+0xc7d4155)
[2022-03-23T18:37:47.179Z]     #16 testing::Test::Run() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2469:3 (gtests_dbms+0xc7b3b94)
[2022-03-23T18:37:47.179Z]     #17 testing::TestInfo::Run() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2655:11 (gtests_dbms+0xc7b5641)
[2022-03-23T18:37:47.179Z]     #18 testing::TestCase::Run() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2773:28 (gtests_dbms+0xc7b62fd)
[2022-03-23T18:37:47.179Z]     #19 testing::internal::UnitTestImpl::RunAllTests() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:4673:43 (gtests_dbms+0xc7c1680)
[2022-03-23T18:37:47.179Z]     #20 bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2401:10 (gtests_dbms+0xc7d5215)
[2022-03-23T18:37:47.179Z]     #21 bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:2437:14 (gtests_dbms+0xc7d5215)
[2022-03-23T18:37:47.179Z]     #22 testing::UnitTest::Run() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/src/gtest.cc:4281:10 (gtests_dbms+0xc7c0b03)
[2022-03-23T18:37:47.179Z]     #23 RUN_ALL_TESTS() /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/contrib/googletest/googletest/include/gtest/gtest.h:2237:46 (gtests_dbms+0x6e169f7)
[2022-03-23T18:37:47.179Z]     #24 main /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/TestUtils/gtests_dbms_main.cpp:36:16 (gtests_dbms+0x6e169f7)
[2022-03-23T18:37:47.179Z] 
[2022-03-23T18:37:47.179Z] SUMMARY: ThreadSanitizer: data race /home/jenkins/agent/workspace/tiflash-sanitizer-daily/tiflash/dbms/src/Storages/DeltaMerge/DeltaIndexManager.cpp:86:26 in DB::DM::DeltaIndexManager::refreshRef(std::__1::shared_ptr<DB::DM::DeltaIndex> const&)

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Compile gtests_dbms in ThreadSanitizer mode and run it.

2. What did you expect to see? (Required)

No data race.

3. What did you see instead (Required)

Some data race happen.

4. What is your TiFlash version? (Required)

master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants