Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save miasantreble/88f5798a397ee7cb8e7baff9db2d9e85 to your computer and use it in GitHub Desktop.
Save miasantreble/88f5798a397ee7cb8e7baff9db2d9e85 to your computer and use it in GitHub Desktop.
race condition in iterator creation
WARNING: ThreadSanitizer: data race (pid=96681)
Write of size 1 at 0x7b5400030198 by thread T30:
#0 rocksdb::BlockBasedTable::UpdateIndexType() table/block_based_table_reader.cc:3166 (db_stress+0x00000088fb2c)
#1 rocksdb::BlockBasedTable::CreateIndexReader(rocksdb::FilePrefetchBuffer*, rocksdb::BlockBasedTable::IndexReader**, rocksdb::InternalIteratorBase<rocksdb::Slice>*, int) table/block_based_table_reader.cc:3181 (db_stress+0x00000089064f)
#2 rocksdb::BlockBasedTable::NewIndexIterator(rocksdb::ReadOptions const&, bool, rocksdb::IndexBlockIter*, rocksdb::BlockBasedTable::CachableEntry<rocksdb::BlockBasedTable::IndexReader>*, rocksdb::GetContext*) table/block_based_table_reader.cc:1901 (db_stress+0x0000008971d6)
#3 rocksdb::BlockBasedTable::NewIterator(rocksdb::ReadOptions const&, rocksdb::SliceTransform const*, rocksdb::Arena*, bool, bool) table/block_based_table_reader.cc:2635 (db_stress+0x00000089b8ac)
#4 rocksdb::TableCache::NewIterator(rocksdb::ReadOptions const&, rocksdb::EnvOptions const&, rocksdb::InternalKeyComparator const&, rocksdb::FileMetaData const&, rocksdb::RangeDelAggregator*, rocksdb::SliceTransform const*, rocksdb::TableReader**, rocksdb::HistogramImpl*, bool, rocksdb::Arena*, bool, int, rocksdb::InternalKey const*, rocksdb::InternalKey const*) db/table_cache.cc:247 (db_stress+0x00000070c43a)
#5 NewFileIterator db/version_set.cc:977 (db_stress+0x000000734c57)
#6 InitFileIterator db/version_set.cc:1147 (db_stress+0x000000734c57)
#7 SkipEmptyFileForward db/version_set.cc:1095 (db_stress+0x0000007368be)
#8 NextImpl db/version_set.cc:950 (db_stress+0x000000736ae9)
#9 NextAndGetResult db/version_set.cc:1067 (db_stress+0x000000736ae9)
#10 rocksdb::IteratorWrapperBase<rocksdb::Slice>::Next() table/iterator_wrapper.h:68 (db_stress+0x0000008ee50f)
#11 rocksdb::MergingIterator::Next() table/merging_iterator.cc:200 (db_stress+0x0000008ee50f)
#12 rocksdb::InternalIteratorBase<rocksdb::Slice>::NextAndGetResult(rocksdb::Slice*) table/internal_iterator.h:58 (db_stress+0x0000006625a7)
#13 rocksdb::IteratorWrapperBase<rocksdb::Slice>::Next() table/iterator_wrapper.h:68 (db_stress+0x0000006625a7)
#14 rocksdb::DBIter::FindNextUserEntryInternal(bool, bool) db/db_iter.cc:621 (db_stress+0x00000066501f)
#15 rocksdb::DBIter::FindNextUserEntry(bool, bool) db/db_iter.cc:427 (db_stress+0x00000066dcbd)
#16 rocksdb::DBIter::Next() db/db_iter.cc:400 (db_stress+0x00000066dcbd)
#17 rocksdb::ArenaWrappedDBIter::Next() db/db_iter.cc:1502 (db_stress+0x00000066dcbd)
#18 TestIterate tools/db_stress.cc:2318 (db_stress+0x00000049fa6f)
#19 OperateDb tools/db_stress.cc:2217 (db_stress+0x0000004b3f70)
#20 rocksdb::StressTest::ThreadBody(void*) tools/db_stress.cc:1651 (db_stress+0x0000004b7960)
#21 StartThreadWrapper env/env_posix.cc:1056 (db_stress+0x0000007bf2bd)
Previous write of size 1 at 0x7b5400030198 by thread T36:
#0 rocksdb::BlockBasedTable::UpdateIndexType() table/block_based_table_reader.cc:3166 (db_stress+0x00000088fb2c)
#1 rocksdb::BlockBasedTable::CreateIndexReader(rocksdb::FilePrefetchBuffer*, rocksdb::BlockBasedTable::IndexReader**, rocksdb::InternalIteratorBase<rocksdb::Slice>*, int) table/block_based_table_reader.cc:3181 (db_stress+0x00000089064f)
#2 rocksdb::BlockBasedTable::NewIndexIterator(rocksdb::ReadOptions const&, bool, rocksdb::IndexBlockIter*, rocksdb::BlockBasedTable::CachableEntry<rocksdb::BlockBasedTable::IndexReader>*, rocksdb::GetContext*) table/block_based_table_reader.cc:1901 (db_stress+0x0000008971d6)
#3 rocksdb::BlockBasedTable::NewIterator(rocksdb::ReadOptions const&, rocksdb::SliceTransform const*, rocksdb::Arena*, bool, bool) table/block_based_table_reader.cc:2635 (db_stress+0x00000089b8ac)
#4 rocksdb::TableCache::NewIterator(rocksdb::ReadOptions const&, rocksdb::EnvOptions const&, rocksdb::InternalKeyComparator const&, rocksdb::FileMetaData const&, rocksdb::RangeDelAggregator*, rocksdb::SliceTransform const*, rocksdb::TableReader**, rocksdb::HistogramImpl*, bool, rocksdb::Arena*, bool, int, rocksdb::InternalKey const*, rocksdb::InternalKey const*) db/table_cache.cc:247 (db_stress+0x00000070c43a)
#5 NewFileIterator db/version_set.cc:977 (db_stress+0x000000734c57)
#6 InitFileIterator db/version_set.cc:1147 (db_stress+0x000000734c57)
#7 SkipEmptyFileForward db/version_set.cc:1095 (db_stress+0x0000007368be)
#8 NextImpl db/version_set.cc:950 (db_stress+0x000000736ae9)
#9 NextAndGetResult db/version_set.cc:1067 (db_stress+0x000000736ae9)
#10 rocksdb::IteratorWrapperBase<rocksdb::Slice>::Next() table/iterator_wrapper.h:68 (db_stress+0x0000008ee50f)
#11 rocksdb::MergingIterator::Next() table/merging_iterator.cc:200 (db_stress+0x0000008ee50f)
#12 rocksdb::InternalIteratorBase<rocksdb::Slice>::NextAndGetResult(rocksdb::Slice*) table/internal_iterator.h:58 (db_stress+0x0000006625a7)
#13 rocksdb::IteratorWrapperBase<rocksdb::Slice>::Next() table/iterator_wrapper.h:68 (db_stress+0x0000006625a7)
#14 rocksdb::DBIter::FindNextUserEntryInternal(bool, bool) db/db_iter.cc:621 (db_stress+0x00000066501f)
#15 rocksdb::DBIter::FindNextUserEntry(bool, bool) db/db_iter.cc:427 (db_stress+0x00000066dcbd)
#16 rocksdb::DBIter::Next() db/db_iter.cc:400 (db_stress+0x00000066dcbd)
#17 rocksdb::ArenaWrappedDBIter::Next() db/db_iter.cc:1502 (db_stress+0x00000066dcbd)
#18 TestIterate tools/db_stress.cc:2318 (db_stress+0x00000049fa6f)
#19 OperateDb tools/db_stress.cc:2217 (db_stress+0x0000004b3f70)
#20 rocksdb::StressTest::ThreadBody(void*) tools/db_stress.cc:1651 (db_stress+0x0000004b7960)
#21 StartThreadWrapper env/env_posix.cc:1056 (db_stress+0x0000007bf2bd)
Location is heap block of size 632 at 0x7b540002ff80 allocated by thread T25:
#0 operator new(unsigned long) <null> (libtsan.so.0+0x000000078aba)
#1 rocksdb::BlockBasedTable::Open(rocksdb::ImmutableCFOptions const&, rocksdb::EnvOptions const&, rocksdb::BlockBasedTableOptions const&, rocksdb::InternalKeyComparator const&, std::unique_ptr<rocksdb::RandomAccessFileReader, std::default_delete<rocksdb::RandomAccessFileReader> >&&, unsigned long, std::unique_ptr<rocksdb::TableReader, std::default_delete<rocksdb::TableReader> >*, rocksdb::SliceTransform const*, bool, bool, int, bool, unsigned long, rocksdb::TailPrefetchStats*) table/block_based_table_reader.cc:822 (db_stress+0x000000898e69)
#2 rocksdb::BlockBasedTableFactory::NewTableReader(rocksdb::TableReaderOptions const&, std::unique_ptr<rocksdb::RandomAccessFileReader, std::default_delete<rocksdb::RandomAccessFileReader> >&&, unsigned long, std::unique_ptr<rocksdb::TableReader, std::default_delete<rocksdb::TableReader> >*, bool) const table/block_based_table_factory.cc:206 (db_stress+0x0000008820fc)
#3 rocksdb::TableCache::GetTableReader(rocksdb::EnvOptions const&, rocksdb::InternalKeyComparator const&, rocksdb::FileDescriptor const&, bool, unsigned long, bool, rocksdb::HistogramImpl*, std::unique_ptr<rocksdb::TableReader, std::default_delete<rocksdb::TableReader> >*, rocksdb::SliceTransform const*, bool, int, bool, bool) db/table_cache.cc:125 (db_stress+0x0000007088a2)
#4 rocksdb::TableCache::FindTable(rocksdb::EnvOptions const&, rocksdb::InternalKeyComparator const&, rocksdb::FileDescriptor const&, rocksdb::Cache::Handle**, rocksdb::SliceTransform const*, bool, bool, rocksdb::HistogramImpl*, bool, int, bool) db/table_cache.cc:164 (db_stress+0x000000709612)
#5 rocksdb::VersionBuilder::Rep::LoadTableHandlers(rocksdb::InternalStats*, int, bool, bool, rocksdb::SliceTransform const*)::{lambda()#1}::operator()() const db/version_builder.cc:434 (db_stress+0x000000716416)
#6 std::_Function_handler<void (), rocksdb::VersionBuilder::Rep::LoadTableHandlers(rocksdb::InternalStats*, int, bool, bool, rocksdb::SliceTransform const*)::{lambda()#1}>::_M_invoke(std::_Any_data const&) /mnt/gvfs/third-party2/libgcc/c67031f0f739ac61575a061518d6ef5038f99f90/7.x/platform007/5620abc/include/c++/7.3.0/bits/std_function.h:316 (db_stress+0x000000716416)
#7 std::function<void ()>::operator()() const /mnt/gvfs/third-party2/libgcc/c67031f0f739ac61575a061518d6ef5038f99f90/7.x/platform007/5620abc/include/c++/7.3.0/bits/std_function.h:706 (db_stress+0x000000716643)
#8 void std::__invoke_impl<void, std::function<void ()>>(std::__invoke_other, std::function<void ()>&&) /mnt/gvfs/third-party2/libgcc/c67031f0f739ac61575a061518d6ef5038f99f90/7.x/platform007/5620abc/include/c++/7.3.0/bits/invoke.h:60 (db_stress+0x00000071668d)
#9 std::__invoke_result<std::function<void ()>>::type std::__invoke<std::function<void ()>>(std::function<void ()>&&) /mnt/gvfs/third-party2/libgcc/c67031f0f739ac61575a061518d6ef5038f99f90/7.x/platform007/5620abc/include/c++/7.3.0/bits/invoke.h:95 (db_stress+0x00000071668d)
#10 decltype (__invoke((_S_declval<0ul>)())) std::thread::_Invoker<std::tuple<std::function<void ()> > >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /mnt/gvfs/third-party2/libgcc/c67031f0f739ac61575a061518d6ef5038f99f90/7.x/platform007/5620abc/include/c++/7.3.0/thread:234 (db_stress+0x00000071668d)
#11 std::thread::_Invoker<std::tuple<std::function<void ()> > >::operator()() /mnt/gvfs/third-party2/libgcc/c67031f0f739ac61575a061518d6ef5038f99f90/7.x/platform007/5620abc/include/c++/7.3.0/thread:243 (db_stress+0x00000071668d)
#12 std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::function<void ()> > > >::_M_run() /mnt/gvfs/third-party2/libgcc/c67031f0f739ac61575a061518d6ef5038f99f90/7.x/platform007/5620abc/include/c++/7.3.0/thread:186 (db_stress+0x00000071668d)
#13 execute_native_thread_routine <null> (libstdc++.so.6+0x0000000ca74f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment