Skip to content

Logical error: Cannot acquire exclusive lock while RWLock is already locked #79413

Closed

Description

@PedroTadim

Describe the bug

This is a regression since v25.3. The statements run in parallel, so it may not reproduce always.

How to reproduce

Run Fiddle: https://fiddle.clickhouse.com/c0530832-8433-4b20-9db3-6ab5d44f3692

Error message and/or stacktrace

Stack trace:

<Fatal> : Logical error: 'RWLockImpl::getLock(): Cannot acquire exclusive lock while RWLock is already locked'.
<Fatal> : Stack trace (when copying this message, always include the lines below):

0. contrib/llvm-project/libcxx/include/__exception/exception.h:113: Poco::Exception::Exception(String const&, int) @ 0x000000001aba4b92
1. src/Common/Exception.cpp:108: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000fc9b779
2. src/Common/Exception.h:112: DB::Exception::Exception(PreformattedMessage&&, int) @ 0x0000000009fce8ac
3. src/Common/Exception.h:130: DB::Exception::Exception<>(int, FormatStringHelperImpl<>) @ 0x0000000009fd7feb
4. src/Common/RWLock.cpp:145: DB::RWLockImpl::getLock(DB::RWLockImpl::Type, String const&, std::chrono::duration<long long, std::ratio<1l, 1000l>> const&, bool) @ 0x0000000015cb2cd5
5. src/Storages/IStorage.cpp:57: DB::IStorage::tryLockTimed(std::shared_ptr<DB::RWLockImpl> const&, DB::RWLockImpl::Type, String const&, std::chrono::duration<long long, std::ratio<1l, 1000l>> const&) const @ 0x0000000015cada90
6. src/Storages/IStorage.cpp:125: DB::IStorage::lockExclusively(String const&, std::chrono::duration<long long, std::ratio<1l, 1000l>> const&) @ 0x0000000015cae44d
7. src/Interpreters/InterpreterDropQuery.cpp:279: DB::InterpreterDropQuery::executeToTableImpl(std::shared_ptr<DB::Context const> const&, DB::ASTDropQuery&, std::shared_ptr<DB::IDatabase>&, StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag>&) @ 0x00000000148dc817
8. src/Interpreters/InterpreterDropQuery.cpp:119: DB::InterpreterDropQuery::executeToTable(DB::ASTDropQuery&) @ 0x00000000148dad34
9. src/Interpreters/InterpreterDropQuery.cpp:92: DB::InterpreterDropQuery::executeSingleDropQuery(std::shared_ptr<DB::IAST> const&) @ 0x00000000148da487
10. src/Interpreters/InterpreterDropQuery.cpp:73: DB::InterpreterDropQuery::execute() @ 0x00000000148da0e5
11. src/Interpreters/executeQuery.cpp:1515: DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, DB::ReadBuffer*, std::shared_ptr<DB::IAST>&) @ 0x0000000014c04b63
12. src/Interpreters/executeQuery.cpp:1707: DB::executeQuery(String const&, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x0000000014bfef68
13. src/Interpreters/InterpreterParallelWithQuery.cpp:122: DB::InterpreterParallelWithQuery::executeSubquery(std::shared_ptr<DB::IAST>, std::shared_ptr<DB::Context>) @ 0x0000000014c7f405
14. src/Interpreters/InterpreterParallelWithQuery.cpp:97: void std::__function::__policy_invoker<void ()>::__call_impl[abi:se190107]<std::__function::__default_alloc_func<DB::InterpreterParallelWithQuery::executeSubqueries(absl::InlinedVector<std::shared_ptr<DB::IAST>, 7ul, std::allocator<std::shared_ptr<DB::IAST>>> const&)::$_0, void ()>>(std::__function::__policy_storage const*) @ 0x0000000014c7fa5b
15. contrib/llvm-project/libcxx/include/__functional/function.h:716: ? @ 0x00000000110749f0
16. src/Common/threadPoolCallbackRunner.h:178: DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>, std::function<void ()>>::operator()(std::function<void ()>&&, Priority, std::optional<unsigned long>)::'lambda'()::operator()() @ 0x000000001107481b
17. contrib/llvm-project/libcxx/include/__functional/function.h:716: ? @ 0x000000000fdba693
18. contrib/llvm-project/libcxx/include/__type_traits/invoke.h:117: ThreadFromGlobalPoolImpl<false, true>::ThreadFromGlobalPoolImpl<void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::*)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool*>(void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::*&&)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool*&&)::'lambda'()::operator()() @ 0x000000000fdc0503
19. contrib/llvm-project/libcxx/include/__functional/function.h:716: ? @ 0x000000000fdb7dd2
20. contrib/llvm-project/libcxx/include/__type_traits/invoke.h:117: void* std::__thread_proxy[abi:se190107]<std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void (ThreadPoolImpl<std::thread>::ThreadFromThreadPool::*)(), ThreadPoolImpl<std::thread>::ThreadFromThreadPool*>>(void*) @ 0x000000000fdbe0c0
21. ? @ 0x00007ffff7ca1e2e
22. ? @ 0x00007ffff7d33a4c

Activity

  1. added
    bug
    fuzz
    on Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugfuzz

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions