pingcap / pingcap/tiflash

AddressSanitizer: stack-use-after-scope in `MemoryTracker::alloc`

Open
#4,051 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/compute help wanted severity/moderate type/bug
Dominant language
C++
Stars
1k
Forks
423
Avg merge
1d 15h
Merged PRs (30d)
24

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)
# build gtests_dbms with "ASan"
cmake -DCMAKE_BUILD_TYPE=ASan -DENABLE_TESTS=ON -GNinja ..
./dbms/gtests_dbms
2. What did you expect to see? (Required)
3. What did you see instead (Required)

Full log: dbms.1.log.zip
Another dbms.2.log.zip

...
[ RUN      ] DatabaseTiFlashTest.RenameTable
...
=================================================================
==77559==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffee7f9b960 at pc 0x00001acfc8fd bp 0x7ffee7f8cc30 sp 0x7ffee7f8cc28
WRITE of size 8 at 0x7ffee7f9b960 thread T0
    #0 0x1acfc8fc in long std::__1::__cxx_atomic_fetch_add<long>(std::__1::__cxx_atomic_base_impl<long>*, long, std::__1::memory_order) /opt/tiflash-env/sysroot/bin/../include/c++/v1/atomic:1060:12
    #1 0x1acfc8fc in std::__1::__atomic_base<long, true>::fetch_add(long, std::__1::memory_order) /opt/tiflash-env/sysroot/bin/../include/c++/v1/atomic:1730:17
    #2 0x1acfc8fc in MemoryTracker::alloc(long) /DATA/disk1/jaysonhuang/tics/dbms/src/Common/MemoryTracker.cpp:56:35
    #3 0x1acfcf7b in CurrentMemoryTracker::checkSubmitAndUpdateLocalDelta(long) /DATA/disk1/jaysonhuang/tics/dbms/src/Common/MemoryTracker.cpp:168:37
    #4 0x1acfcf7b in CurrentMemoryTracker::alloc(long) /DATA/disk1/jaysonhuang/tics/dbms/src/Common/MemoryTracker.cpp:190:5
    #5 0x1aca5715 in Allocator<false>::alloc(unsigned long, unsigned long) /DATA/disk1/jaysonhuang/tics/dbms/src/Common/Allocator.cpp:54:5
    #6 0x1adc1e78 in DB::Memory::alloc() /DATA/disk1/jaysonhuang/tics/dbms/src/IO/BufferWithOwnMemory.h:112:49
    #7 0x1adc1e78 in DB::Memory::Memory(unsigned long, unsigned long) /DATA/disk1/jaysonhuang/tics/dbms/src/IO/BufferWithOwnMemory.h:41:9
    #8 0x1adc1e78 in DB::BufferWithOwnMemory<DB::WriteBuffer>::BufferWithOwnMemory(unsigned long, char*, unsigned long) /DATA/disk1/jaysonhuang/tics/dbms/src/IO/BufferWithOwnMemory.h:141:11
    #9 0x1adc1e78 in DB::CompressedWriteBuffer<false>::CompressedWriteBuffer(DB::WriteBuffer&, DB::CompressionSettings, unsigned long) /DATA/disk1/jaysonhuang/tics/dbms/src/IO/CompressedWriteBuffer.cpp:129:7
    #10 0xc2b7e47 in DB::DM::DMFileWriter::Stream::Stream(std::__1::shared_ptr<DB::DM::DMFile> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::IDataType const> const&, DB::CompressionSettings, unsigned long, std::__1::shared_ptr<DB::FileProvider>&, std::__1::shared_ptr<DB::WriteLimiter> const&, bool) /DATA/disk1/jaysonhuang/tics/dbms/src/Storages/DeltaMerge/File/DMFileWriter.h:56:69
    #11 0xc2a81a9 in std::__1::__unique_if<DB::DM::DMFileWriter::Stream>::__unique_single std::__1::make_unique<DB::DM::DMFileWriter::Stream, std::__1::shared_ptr<DB::DM::DMFile>&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::IDataType const>&, DB::CompressionSettings&, unsigned long&, std::__1::shared_ptr<DB::FileProvider>&, std::__1::shared_ptr<DB::WriteLimiter>&, bool>(std::__1::shared_ptr<DB::DM::DMFile>&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::IDataType const>&, DB::CompressionSettings&, unsigned long&, std::__1::shared_ptr<DB::FileProvider>&, std::__1::shared_ptr<DB::WriteLimiter>&, bool&&) /opt/tiflash-env/sysroot/bin/../include/c++/v1/__memory/unique_ptr.h:728:32
    #12 0xc2a81a9 in DB::DM::DMFileWriter::addStreams(long, std::__1::shared_ptr<DB::IDataType const>, bool)::$_2::operator()(std::__1::vector<DB::IDataType::Substream, std::__1::allocator<DB::IDataType::Substream> > const&) const /DATA/disk1/jaysonhuang/tics/dbms/src/Storages/DeltaMerge/File/DMFileWriter.cpp:92:23
    #13 0xc2a81a9 in decltype(static_cast<DB::DM::DMFileWriter::addStreams(long, std::__1::shared_ptr<DB::IDataType const>, bool)::$_2&>(fp)(static_cast<std::__1::vector<DB::IDataType::Substream, std::__1::allocator<DB::IDataType::Substream> > const&>(fp0))) std::__1::__invoke<DB::DM::DMFileWriter::addStreams(long, std::__1::shared_ptr<DB::IDataType const>, bool)::$_2&, std::__1::vector<DB::IDataType::Substream, std::__1::allocator<DB::IDataType::Substream> > const&>(DB::DM::DMFileWriter::addStreams(long, std::__1::shared_ptr<DB::IDataType const>, bool)::$_2&, std::__1::vector<DB::IDataType::Substream, std::__1::allocator<DB::IDataType::Substream> > const&) /opt/tiflash-env/sysroot/bin/../include/c++/v1/type_traits:3918:1
    #14 0xc2a81a9 in void std::__1::__invoke_void_return_wrapper<void, true>::__call<DB::DM::DMFileWriter::addStreams(long, std::__1::shared_ptr<DB::IDataType const>, bool)::$_2&, std::__1::vector<DB::IDataType::Substream, std::__1::allocator<DB::IDataType::Substream> > const&>(DB::DM::DMFileWriter::addStreams(long, std::__1::shared_ptr<DB::IDataType const>, bool)::$_2&, std::__1::vector<DB::IDataType::Substream, std::__1::allocator<DB::IDataType::Substream> > const&) /opt/tiflash-env/sysroot/bin/../include/c++/v1/__functional/invoke.h:61:9
    #15 0xc2a81a9 in std::__1::__function::__alloc_func<DB::DM::DMFileWriter::addStreams(long, std::__1::shared_ptr<DB::IDataType const>, bool)::$_2, std::__1::allocator<DB::DM::DMFileWriter::addStreams(long, std::__1::shared_ptr<DB::IDataType const>, bool)::$_2>, void (std::__1::vector<DB::IDataType::Substream, std::__1::allocator<DB::IDataType::Substream> > const&)>::operator()(std::__1::vector<DB::IDataType::Substream, std::__1::allocator<DB::IDataType::Substream> > const&) /opt/tiflash-env/sysroot/bin/../include/c++/v1/__functional/function.h:171:16
    #16 0xc2a81a9 in std::__1::__function::__func<DB::DM::DMFileWriter::addStreams(long, std::__1::shared_ptr<DB::IDataType const>, bool)::$_2, std::__1::allocator<DB::DM::DMFileWriter::addStreams(long, std::__1::shared_ptr<DB::IDataType const>, bool)::$_2>, void (std::__1::vector<DB::IDataType::Substream, std::__1::allocator<DB::IDataType::Substream> > const&)>::operator()(std::__1::vector<DB::IDataType::Substream, std::__1::allocator<DB::IDataType::Substream> > const&) /opt/tiflash-env/sysroot/bin/../include/c++/v1/__functional/function.h:345:12
    #17 0xc2a3974 in DB::IDataType::enumerateStreams(std::__1::function<void (std::__1::vector<DB::IDataType::Substream, std::__1::allocator<DB::IDataType::Substream> > const&)> const&, std::__1::vector<DB::IDataType::Substream, std::__1::allocator<DB::IDataType::Substream> >&&) const /DATA/disk1/jaysonhuang/tics/dbms/src/DataTypes/IDataType.h:102:91
    #18 0xc2a3974 in DB::DM::DMFileWriter::addStreams(long, std::__1::shared_ptr<DB::IDataType const>, bool) /DATA/disk1/jaysonhuang/tics/dbms/src/Storages/DeltaMerge/File/DMFileWriter.cpp:104:11
    #19 0xc2a1db6 in DB::DM::DMFileWriter::DMFileWriter(std::__1::shared_ptr<DB::DM::DMFile> const&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > const&, std::__1::shared_ptr<DB::FileProvider> const&, std::__1::shared_ptr<DB::WriteLimiter> const&, DB::DM::DMFileWriter::Options const&) /DATA/disk1/jaysonhuang/tics/dbms/src/Storages/DeltaMerge/File/DMFileWriter.cpp:82:13
    #20 0x8730e17 in DB::DM::DMFileBlockOutputStream::DMFileBlockOutputStream(DB::Context const&, std::__1::shared_ptr<DB::DM::DMFile> const&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > const&, DB::DM::DMFileWriter::Flags, DB::CompressionSettings) /DATA/disk1/jaysonhuang/tics/dbms/src/Storages/DeltaMerge/File/DMFileBlockOutputStream.h:28:11
    #21 0xc10caee in std::__1::__shared_ptr_emplace<DB::DM::DMFileBlockOutputStream, std::__1::allocator<DB::DM::DMFileBlockOutputStream> >::__shared_ptr_emplace<DB::Context const&, std::__1::shared_ptr<DB::DM::DMFile>&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&, DB::DM::DMFileWriter::Flags&>(std::__1::allocator<DB::DM::DMFileBlockOutputStream>, DB::Context const&, std::__1::shared_ptr<DB::DM::DMFile>&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&, DB::DM::DMFileWriter::Flags&) /opt/tiflash-env/sysroot/bin/../include/c++/v1/__memory/shared_ptr.h:298:37
    #22 0xc10caee in std::__1::shared_ptr<DB::DM::DMFileBlockOutputStream> std::__1::allocate_shared<DB::DM::DMFileBlockOutputStream, std::__1::allocator<DB::DM::DMFileBlockOutputStream>, DB::Context const&, std::__1::shared_ptr<DB::DM::DMFile>&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&, DB::DM::DMFileWriter::Flags&, void>(std::__1::allocator<DB::DM::DMFileBlockOutputStream> const&, DB::Context const&, std::__1::shared_ptr<DB::DM::DMFile>&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&, DB::DM::DMFileWriter::Flags&) /opt/tiflash-env/sysroot/bin/../include/c++/v1/__memory/shared_ptr.h:1106:55
    #23 0xc10caee in std::__1::shared_ptr<DB::DM::DMFileBlockOutputStream> std::__1::make_shared<DB::DM::DMFileBlockOutputStream, DB::Context const&, std::__1::shared_ptr<DB::DM::DMFile>&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&, DB::DM::DMFileWriter::Flags&, void>(DB::Context const&, std::__1::shared_ptr<DB::DM::DMFile>&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&, DB::DM::DMFileWriter::Flags&) /opt/tiflash-env/sysroot/bin/../include/c++/v1/__memory/shared_ptr.h:1115:12
    #24 0xc10caee in DB::DM::writeIntoNewDMFile(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::IBlockInputStream> const&, unsigned long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::DM::DMFileWriter::Flags) /DATA/disk1/jaysonhuang/tics/dbms/src/Storages/DeltaMerge/Segment.cpp:91:26
    #25 0xc10d5d8 in DB::DM::createNewStable(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::IBlockInputStream> const&, unsigned long, DB::DM::WriteBatches&) /DATA/disk1/jaysonhuang/tics/dbms/src/Storages/DeltaMerge/Segment.cpp:149:19
    #26 0xc10f8fb in DB::DM::Segment::newSegment(DB::DM::DMContext&, std::__1::shared_ptr<std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > > const&, DB::DM::RowKeyRange const&, unsigned long, unsigned long, unsigned long, unsigned long) /DATA/disk1/jaysonhuang/tics/dbms/src/Storages/DeltaMerge/Segment.cpp:191:19
    #27 0xc11073e in DB::DM::Segment::newSegment(DB::DM::DMContext&, std::__1::shared_ptr<std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> > > const&, DB::DM::RowKeyRange const&, unsigned long, unsigned long) /DATA/disk1/jaysonhuang/tics/dbms/src/Storages/DeltaMerge/Segment.cpp:213:12
    #28 0xc05f5c2 in 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&, 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&) /DATA/disk1/jaysonhuang/tics/dbms/src/Storages/DeltaMerge/DeltaMergeStore.cpp:227:19
    #29 0xbe59568 in std::__1::__shared_ptr_emplace<DB::DM::DeltaMergeStore, std::__1::allocator<DB::DM::DeltaMergeStore> >::__shared_ptr_emplace<DB::Context&, bool const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, 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 const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&&, DB::DM::ColumnDefine&&, bool&, unsigned long&, DB::DM::DeltaMergeStore::Settings&&) /opt/tiflash-env/sysroot/bin/../include/c++/v1/__memory/shared_ptr.h:298:37
    #30 0xbe59568 in std::__1::shared_ptr<DB::DM::DeltaMergeStore> std::__1::allocate_shared<DB::DM::DeltaMergeStore, std::__1::allocator<DB::DM::DeltaMergeStore>, DB::Context&, bool const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, 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 const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&&, DB::DM::ColumnDefine&&, bool&, unsigned long&, DB::DM::DeltaMergeStore::Settings&&) /opt/tiflash-env/sysroot/bin/../include/c++/v1/__memory/shared_ptr.h:1106:55
    #31 0xbe59568 in std::__1::shared_ptr<DB::DM::DeltaMergeStore> std::__1::make_shared<DB::DM::DeltaMergeStore, DB::Context&, bool const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, 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 const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::vector<DB::DM::ColumnDefine, std::__1::allocator<DB::DM::ColumnDefine> >&&, DB::DM::ColumnDefine&&, bool&, unsigned long&, DB::DM::DeltaMergeStore::Settings&&) /opt/tiflash-env/sysroot/bin/../include/c++/v1/__memory/shared_ptr.h:1115:12
    #32 0xbe59568 in DB::StorageDeltaMerge::getAndMaybeInitStore() /DATA/disk1/jaysonhuang/tics/dbms/src/Storages/StorageDeltaMerge.cpp:1484:18
    #33 0xbe7322e in DB::StorageDeltaMerge::rename(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&, 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&) /DATA/disk1/jaysonhuang/tics/dbms/src/Storages/StorageDeltaMerge.cpp:1152:20
    #34 0x96a81d9 in DB::DatabaseTiFlash::renameTable(DB::Context const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::IDatabase&, 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&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /DATA/disk1/jaysonhuang/tics/dbms/src/Databases/DatabaseTiFlash.cpp:353:12
    #35 0x5b115e7 in DB::tests::DatabaseTiFlashTest_RenameTable_Test::TestBody() /DATA/disk1/jaysonhuang/tics/dbms/src/Databases/test/gtest_database.cpp:265:51
    #36 0x191509b0 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /DATA/disk1/jaysonhuang/tics/contrib/googletest/googletest/src/gtest.cc:2401:10
    #37 0x191509b0 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /DATA/disk1/jaysonhuang/tics/contrib/googletest/googletest/src/gtest.cc:2437:14
    #38 0x19100f48 in testing::Test::Run() /DATA/disk1/jaysonhuang/tics/contrib/googletest/googletest/src/gtest.cc:2473:5
    #39 0x19104057 in testing::TestInfo::Run() /DATA/disk1/jaysonhuang/tics/contrib/googletest/googletest/src/gtest.cc:2655:11
    #40 0x191055bf in testing::TestCase::Run() /DATA/disk1/jaysonhuang/tics/contrib/googletest/googletest/src/gtest.cc:2773:28
    #41 0x191207b8 in testing::internal::UnitTestImpl::RunAllTests() /DATA/disk1/jaysonhuang/tics/contrib/googletest/googletest/src/gtest.cc:4673:43
    #42 0x191529e0 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /DATA/disk1/jaysonhuang/tics/contrib/googletest/googletest/src/gtest.cc:2401:10
    #43 0x191529e0 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /DATA/disk1/jaysonhuang/tics/contrib/googletest/googletest/src/gtest.cc:2437:14
    #44 0x1911f3da in testing::UnitTest::Run() /DATA/disk1/jaysonhuang/tics/contrib/googletest/googletest/src/gtest.cc:4281:10
    #45 0x93f017a in RUN_ALL_TESTS() /DATA/disk1/jaysonhuang/tics/contrib/googletest/googletest/include/gtest/gtest.h:2237:46
    #46 0x93f017a in main /DATA/disk1/jaysonhuang/tics/dbms/src/TestUtils/gtests_dbms_main.cpp:22:16
    #47 0x7f0a3331e554 in __libc_start_main (/lib64/libc.so.6+0x22554)
    #48 0x578b2e8 in _start (/DATA/disk1/jaysonhuang/tics/cmake-build-asan/dbms/gtests_dbms+0x578b2e8)

Address 0x7ffee7f9b960 is located in stack of thread T0 at offset 9952 in frame
    #0 0x5b0dd8f in DB::tests::DatabaseTiFlashTest_RenameTable_Test::TestBody() /DATA/disk1/jaysonhuang/tics/dbms/src/Databases/test/gtest_database.cpp:208

  This frame has 113 object(s):
    [32, 48) 'ref.tmp.i1045'
    [64, 96) 'ref.tmp.i1032'
    [128, 144) 'ref.tmp.i'
    [160, 184) 'db_name' (line 210)
    [224, 3648) 'ctx' (line 211)
    [3776, 6488) 'ref.tmp' (line 211)
    [6624, 6648) 'agg.tmp'
    [6688, 6712) 'statement' (line 215)
    [6752, 6776) 'ref.tmp6' (line 215)
    [6816, 6832) 'ast' (line 216)
    [6848, 6864) 'gtest_ar' (line 217)
    [6880, 6888) 'ref.tmp15' (line 217)
    [6912, 6920) 'ref.tmp21' (line 217)
    [6944, 6952) 'ref.tmp24' (line 217)
    [6976, 7024) 'interpreter' (line 218)
    [7056, 7200) 'agg.tmp.ensured'
    [7264, 7280) 'db' (line 224)
    [7296, 7312) 'gtest_ar58' (line 225)
    [7328, 7336) 'ref.tmp59' (line 225)
    [7360, 7368) 'ref.tmp68' (line 225)
    [7392, 7400) 'ref.tmp71' (line 225)
    [7424, 7440) 'gtest_ar89' (line 226)
    [7456, 7480) 'ref.tmp90' (line 226)
    [7520, 7528) 'ref.tmp103' (line 226)
    [7552, 7560) 'ref.tmp106' (line 226)
    [7584, 7600) 'gtest_ar_' (line 227)
    [7616, 7624) 'ref.tmp134' (line 227)
    [7648, 7656) 'ref.tmp137' (line 227)
    [7680, 7704) 'ref.tmp138' (line 227)
    [7744, 7768) 'tbl_name' (line 229)
    [7808, 7816) 'parser' (line 232)
    [7840, 7864) 'stmt' (line 233)
    [7904, 7928) 'ref.tmp157' (line 233)
    [7968, 7992) 'ref.tmp158' (line 233)
    [8032, 8056) 'ref.tmp159' (line 233)
    [8096, 8112) 'ast174' (line 239)
    [8128, 8176) 'interpreter177' (line 241)
    [8208, 8352) 'agg.tmp.ensured183'
    [8416, 8432) 'gtest_ar_193' (line 247)
    [8448, 8456) 'ref.tmp209' (line 247)
    [8480, 8488) 'ref.tmp212' (line 247)
    [8512, 8536) 'ref.tmp213' (line 247)
    [8576, 8592) 'gtest_ar_230' (line 248)
    [8608, 8616) 'ref.tmp246' (line 248)
    [8640, 8648) 'ref.tmp249' (line 248)
    [8672, 8696) 'ref.tmp250' (line 248)
    [8736, 8752) 'storage' (line 252)
    [8768, 8784) 'gtest_ar272' (line 253)
    [8800, 8808) 'ref.tmp273' (line 253)
    [8832, 8840) 'ref.tmp282' (line 253)
    [8864, 8872) 'ref.tmp285' (line 253)
    [8896, 8912) 'gtest_ar303' (line 255)
    [8928, 8952) 'ref.tmp304' (line 255)
    [8992, 9000) 'ref.tmp319' (line 255)
    [9024, 9032) 'ref.tmp322' (line 255)
    [9056, 9072) 'gtest_ar336' (line 256)
    [9088, 9112) 'ref.tmp337' (line 256)
    [9152, 9160) 'ref.tmp352' (line 256)
    [9184, 9192) 'ref.tmp355' (line 256)
    [9216, 9232) 'managed_storage' (line 258)
    [9248, 9264) 'gtest_ar369' (line 259)
    [9280, 9304) 'ref.tmp370' (line 259)
    [9344, 9352) 'ref.tmp385' (line 259)
    [9376, 9384) 'ref.tmp388' (line 259)
    [9408, 9432) 'to_tbl_name' (line 262)
    [9472, 9488) 'old_storage' (line 267)
    [9504, 9520) 'gtest_ar423' (line 268)
    [9536, 9544) 'ref.tmp424' (line 268)
    [9568, 9576) 'ref.tmp433' (line 268)
    [9600, 9608) 'ref.tmp436' (line 268)
    [9632, 9648) 'storage454' (line 270)
    [9664, 9680) 'gtest_ar460' (line 271)
    [9696, 9704) 'ref.tmp461' (line 271)
    [9728, 9736) 'ref.tmp470' (line 271)
    [9760, 9768) 'ref.tmp473' (line 271)
    [9792, 9808) 'gtest_ar491' (line 272)
    [9824, 9848) 'ref.tmp492' (line 272)
    [9888, 9896) 'ref.tmp507' (line 272)
    [9920, 9928) 'ref.tmp510' (line 272)
    [9952, 9968) 'gtest_ar524' (line 273) <== Memory access at offset 9952 is inside this variable
    [9984, 10008) 'ref.tmp525' (line 273)
    [10048, 10056) 'ref.tmp540' (line 273)
    [10080, 10088) 'ref.tmp543' (line 273)
    [10112, 10128) 'managed_storage557' (line 275)
    [10144, 10160) 'gtest_ar558' (line 276)
    [10176, 10200) 'ref.tmp559' (line 276)
    [10240, 10248) 'ref.tmp574' (line 276)
    [10272, 10280) 'ref.tmp577' (line 276)
    [10304, 10320) 'drop_query' (line 281)
    [10336, 10352) 'ast_drop_query' (line 285)
    [10368, 10400) 'drop_interpreter' (line 286)
    [10432, 10576) 'agg.tmp.ensured616'
    [10640, 10656) 'storage619' (line 289)
    [10672, 10688) 'gtest_ar625' (line 290)
    [10704, 10712) 'ref.tmp626' (line 290)
    [10736, 10744) 'ref.tmp635' (line 290)
    [10768, 10776) 'ref.tmp638' (line 290)
    [10800, 10816) 'drop_query674' (line 295)
    [10832, 10848) 'ast_drop_query684' (line 298)
    [10864, 10896) 'drop_interpreter687' (line 299)
    [10928, 11072) 'agg.tmp.ensured690'
    [11136, 11152) 'db693' (line 302)
    [11168, 11184) 'gtest_ar696' (line 303)
    [11200, 11208) 'ref.tmp697' (line 303)
    [11232, 11240) 'ref.tmp706' (line 303)
    [11264, 11272) 'ref.tmp709' (line 303)
    [11296, 11320) 'text' (line 306)
    [11360, 11384) 'ref.tmp784' (line 306)
    [11424, 11448) 'text804' (line 306)
    [11488, 11512) 'ref.tmp813' (line 306)
    [11552, 11576) 'ref.tmp817' (line 306)
    [11616, 11624) 'ref.tmp832' (line 306)
    [11648, 11656) 'ref.tmp838' (line 306)
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-use-after-scope /opt/tiflash-env/sysroot/bin/../include/c++/v1/atomic:1060:12 in long std::__1::__cxx_atomic_fetch_add<long>(std::__1::__cxx_atomic_base_impl<long>*, long, std::__1::memory_order)
Shadow bytes around the buggy address:
  0x10005cfeb6d0: f8 f8 f2 f2 f8 f8 f2 f2 f8 f8 f8 f2 f2 f2 f2 f2
  0x10005cfeb6e0: f8 f2 f2 f2 f8 f2 f2 f2 00 00 00 f2 f2 f2 f2 f2
  0x10005cfeb6f0: f8 f8 f2 f2 f8 f8 f2 f2 f8 f2 f2 f2 f8 f2 f2 f2
  0x10005cfeb700: f8 f2 f2 f2 f8 f8 f2 f2 f8 f8 f2 f2 f8 f2 f2 f2
  0x10005cfeb710: f8 f2 f2 f2 f8 f2 f2 f2 f8 f8 f2 f2 f8 f8 f8 f2
=>0x10005cfeb720: f2 f2 f2 f2 f8 f2 f2 f2 f8 f2 f2 f2[f8]f8 f2 f2
  0x10005cfeb730: f8 f8 f8 f2 f2 f2 f2 f2 f8 f2 f2 f2 f8 f2 f2 f2
  0x10005cfeb740: f8 f8 f2 f2 f8 f8 f2 f2 f8 f8 f8 f2 f2 f2 f2 f2
  0x10005cfeb750: f8 f2 f2 f2 f8 f2 f2 f2 f8 f8 f2 f2 f8 f8 f2 f2
  0x10005cfeb760: f8 f8 f8 f8 f2 f2 f2 f2 00 00 00 00 00 00 00 00
  0x10005cfeb770: 00 00 00 00 00 00 00 00 00 00 f2 f2 f2 f2 f2 f2
...
==77559==ABORTING
4. What is your TiFlash version? (Required)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with the ASan CMake command and ./dbms/gtests_dbms, focusing on the DatabaseTiFlashTest.RenameTable failure. Read dbms/src/Common/MemoryTracker.cpp and follow the reported path through DMFileWriter.cpp and the DeltaMerge entry points. Done means the test run no longer reports the stack-use-after-scope error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.