[BUG] bplus_tree_log_test failed occasionally.
Describe the bug A clear and concise description of what the bug is.
[BUG] bplus_tree_log_test failed occasionally.
in build debug mode,
/home/runner/work/miniob-private/miniob-private/unittest/observer/bplus_tree_log_test.cpp:294: Failure
27: Expected equality of these values:
27: rids1.size()
27: Which is: 1393
27: rids2.size()
27: Which is: 1392
27: =================================================================
27: ==11827==ERROR: AddressSanitizer: heap-use-after-free on address 0x512000000dc0 at pc 0x55e1a9590e56 bp 0x7fff8ffbe2e0 sp 0x7fff8ffbe2d0
27: READ of size 8 at 0x512000000dc0 thread T0
27: #0 0x55e1a9590e55 in BufferPoolLogHandler::flush_page(Page&) /home/runner/work/miniob-private/miniob-private/src/observer/storage/buffer/buffer_pool_log.cpp:45
27: #1 0x55e1a95b4d1a in DiskBufferPool::flush_page_internal(Frame&) /home/runner/work/miniob-private/miniob-private/src/observer/storage/buffer/disk_buffer_pool.cpp:550
27: #2 0x55e1a95b028b in DiskBufferPool::purge_frame(int, Frame*) /home/runner/work/miniob-private/miniob-private/src/observer/storage/buffer/disk_buffer_pool.cpp:483
27: #3 0x55e1a95b2118 in DiskBufferPool::purge_all_pages() /home/runner/work/miniob-private/miniob-private/src/observer/storage/buffer/disk_buffer_pool.cpp:515
27: #4 0x55e1a95a3736 in DiskBufferPool::close_file() /home/runner/work/miniob-private/miniob-private/src/observer/storage/buffer/disk_buffer_pool.cpp:289
27: #5 0x55e1a959e47b in DiskBufferPool::~DiskBufferPool() /home/runner/work/miniob-private/miniob-private/src/observer/storage/buffer/disk_buffer_pool.cpp:225
27: #6 0x55e1a95c5d7f in BufferPoolManager::~BufferPoolManager() /home/runner/work/miniob-private/miniob-private/src/observer/storage/buffer/disk_buffer_pool.cpp:785
27: #7 0x55e1a953ed81 in std::default_delete<BufferPoolManager>::operator()(BufferPoolManager*) const /usr/include/c++/13/bits/unique_ptr.h:99
27: #8 0x55e1a953680d in std::unique_ptr<BufferPoolManager, std::default_delete<BufferPoolManager> >::~unique_ptr() /usr/include/c++/13/bits/unique_ptr.h:404
27: #9 0x55e1a9527a5f in BplusTreeLog_concurrency_Test::TestBody() /home/runner/work/miniob-private/miniob-private/unittest/observer/bplus_tree_log_test.cpp:317
27: #10 0x55e1a9920b1c in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/runner/work/miniob-private/miniob-private/build_debug/bin/bplus_tree_log_test+0x9d2b1c) (BuildId: 6c494f5ef02ffe11fdc839281dd94ff03182992e)
27: #11 0x55e1a99193f6 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/runner/work/miniob-private/miniob-private/build_debug/bin/bplus_tree_log_test+0x9cb3f6) (BuildId: 6c494f5ef02ffe11fdc839281dd94ff03182992e)
27: #12 0x55e1a98f3515 in testing::Test::Run() (/home/runner/work/miniob-private/miniob-private/build_debug/bin/bplus_tree_log_test+0x9a5515) (BuildId: 6c494f5ef02ffe11fdc839281dd94ff03182992e)
27: #13 0x55e1a98f40e6 in testing::TestInfo::Run() (/home/runner/work/miniob-private/miniob-private/build_debug/bin/bplus_tree_log_test+0x9a60e6) (BuildId: 6c494f5ef02ffe11fdc839281dd94ff03182992e)
27: #14 0x55e1a98f4a88 in testing::TestSuite::Run() (/home/runner/work/miniob-private/miniob-private/build_debug/bin/bplus_tree_log_test+0x9a6a88) (BuildId: 6c494f5ef02ffe11fdc839281dd94ff03182992e)
27: #15 0x55e1a9905b15 in testing::internal::UnitTestImpl::RunAllTests() (/home/runner/work/miniob-private/miniob-private/build_debug/bin/bplus_tree_log_test+0x9b7b15) (BuildId: 6c494f5ef02ffe11fdc839281dd94ff03182992e)
27: #16 0x55e1a9921ce6 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/runner/work/miniob-private/miniob-private/build_debug/bin/bplus_tree_log_test+0x9d3ce6) (BuildId: 6c494f5ef02ffe11fdc839281dd94ff03182992e)
27: #17 0x55e1a991a722 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/runner/work/miniob-private/miniob-private/build_debug/bin/bplus_tree_log_test+0x9cc722) (BuildId: 6c494f5ef02ffe11fdc839281dd94ff03182992e)
27: #18 0x55e1a9903f94 in testing::UnitTest::Run() (/home/runner/work/miniob-private/miniob-private/build_debug/bin/bplus_tree_log_test+0x9b5f94) (BuildId: 6c494f5ef02ffe11fdc839281dd94ff03182992e)
27: #19 0x55e1a95307ad in RUN_ALL_TESTS() (/home/runner/work/miniob-private/miniob-private/build_debug/bin/bplus_tree_log_test+0x5e27ad) (BuildId: 6c494f5ef02ffe11fdc839281dd94ff03182992e)
27: #20 0x55e1a952bc01 in main /home/runner/work/miniob-private/miniob-private/unittest/observer/bplus_tree_log_test.cpp:325
27: #21 0x7f967de2a1c9 (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
27: #22 0x7f967de2a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
27: #23 0x55e1a950df54 in _start (/home/runner/work/miniob-private/miniob-private/build_debug/bin/bplus_tree_log_test+0x5bff54) (BuildId: 6c494f5ef02ffe11fdc839281dd94ff03182992e)
** Environment** Environment Details sometimes important
- OS Version:
- CPU Arch(x86/arm):
- Compiler:
- Others:
Fast Reproduce Steps(Required) Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Actual Behavior What is the result? picture is allowed
Additional context Add any other context about the problem here.
i can pass test1 successfully, but failed in test 2 now
like this:
[==========] Running 2 tests from 1 test suite. [----------] Global test environment set-up. [----------] 2 tests from BplusTreeLog [ RUN ] BplusTreeLog.base [ OK ] BplusTreeLog.base (27430 ms) [ RUN ] BplusTreeLog.concurrency bplus_tree_log_test: /root/miniob/src/observer/storage/index/bplus_tree.cpp:557: PageNum InternalIndexNodeHandler::value_at(int): Assertion index >= 0 && index < size() failed. bplus_tree_log_test: /root/miniob/src/observer/storage/index/bplus_tree.cpp:557: PageNum InternalIndexNodeHandler::value_at(int): Assertion index >= 0 && index < size() failed. bplus_tree_log_test: /root/miniob/src/observer/storage/index/bplus_tree.cpp:557: PageNum InternalIndexNodeHandler::value_at(int): Assertion index >= 0 && index < size() failed. bplus_tree_log_test: /root/miniob/src/observer/storage/index/bplus_tree.cpp:557: PageNum InternalIndexNodeHandler::value_at(int): Assertion index >= 0 && index < size() failed. bplus_tree_log_test: /root/miniob/src/observer/storage/index/bplus_tree.cpp:557: PageNum InternalIndexNodeHandler::value_at(int): Assertion index >= 0 && index < size() failed. bplus_tree_log_test: /root/miniob/src/observer/storage/index/bplus_tree.cpp:557: PageNum InternalIndexNodeHandler::value_at(int): Assertion index >= 0 && index < size() failed. bplus_tree_log_test: /root/miniob/src/observer/storage/index/bplus_tree.cpp:557: PageNum InternalIndexNodeHandler::value_at(int): Assertion index >= 0 && index < size() failed. bplus_tree_log_test: /root/miniob/src/observer/storage/index/bplus_tree.cpp:557: PageNum InternalIndexNodeHandler::value_at(int): Assertion index >= 0 && index < size() failed. Aborted (core dumped)
Don't forget to add -DCONCURRENCY=ON during compilation to reproduce the issue. bash build.sh debug -DCONCURRENCY=ON