Repository navigation
Description
Describe the bug
This bug causes ClickHouse server to abort in a debug build.
Affect Version:
Release v24.12.2.29-stable
git hash: e067436
Build Command:
CC=clang-18 CXX=clang++-18 cmake -S . -B build -DCHECK_LARGE_OBJECT_SIZES=0 -DCMAKE_BUILD_TYPE=Debug
How to reproduce
CREATE TABLE t0 (v1 Nullable(Int8), v2 Decimal(18,4)) ENGINE = MergeTree() ORDER BY tuple();
SELECT DISTINCT TOP 1 WITH TIES * FROM t0 ORDER BY tuple();
Error message and/or stacktrace
[b3ea05351c88] 2026.03.22 07:31:42.885078 [ 718130 ] {8f259dc4-a8c1-44fb-aa89-591e07ba8c20} : Logical error: 'LIMIT WITH TIES without ORDER BY'.
[b3ea05351c88] 2026.03.22 07:31:42.903100 [ 718130 ] {8f259dc4-a8c1-44fb-aa89-591e07ba8c20} : Stack trace (when copying this message, always include the lines below):
- /home/fuzzer/ClickHouse/contrib/llvm-project/libcxx/include/exception:141: Poco::Exception::Exception(String const&, int) @ 0x0000000016ab20f2
- /home/fuzzer/ClickHouse/src/Common/Exception.cpp:105: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000c998199
- /home/fuzzer/ClickHouse/src/Common/Exception.h:105: DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000719252c
- /home/fuzzer/ClickHouse/src/Common/Exception.h:123: DB::Exception::Exception<>(int, FormatStringHelperImpl<>) @ 0x00000000071954ab
- /home/fuzzer/ClickHouse/src/Planner/Planner.cpp:1093: DB::(anonymous namespace)::addLimitStep(DB::QueryPlan&, DB::(anonymous namespace)::QueryAnalysisResult const&, std::shared_ptrDB::PlannerContext const&, DB::QueryNode const&) @ 0x00000000124f83cd
- /home/fuzzer/ClickHouse/src/Planner/Planner.cpp:1800: DB::Planner::buildPlanForQueryNode() @ 0x00000000124f3b71
- /home/fuzzer/ClickHouse/src/Planner/Planner.cpp:1300: DB::Planner::buildQueryPlanIfNeeded() @ 0x00000000124ecdbc
- /home/fuzzer/ClickHouse/src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:241: DB::InterpreterSelectQueryAnalyzer::getQueryPlan() @ 0x00000000124eaeed
- /home/fuzzer/ClickHouse/src/Interpreters/executeQuery.cpp:1317: DB::executeQueryImpl(char const*, char const*, std::shared_ptrDB::Context, DB::QueryFlags, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) @ 0x00000000127ceb36
- /home/fuzzer/ClickHouse/src/Interpreters/executeQuery.cpp:1535: DB::executeQuery(String const&, std::shared_ptrDB::Context, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x00000000127ca201
- /home/fuzzer/ClickHouse/src/Server/TCPHandler.cpp:656: DB::TCPHandler::runImpl() @ 0x0000000013f3a8a6
- /home/fuzzer/ClickHouse/src/Server/TCPHandler.cpp:2603: DB::TCPHandler::run() @ 0x0000000013f517f9
- /home/fuzzer/ClickHouse/base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x0000000016b57807
- /home/fuzzer/ClickHouse/base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x0000000016b57cde
- /home/fuzzer/ClickHouse/base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x0000000016b04192
- /home/fuzzer/ClickHouse/base/poco/Foundation/src/Thread_POSIX.cpp:335: Poco::ThreadImpl::runnableEntry(void*) @ 0x0000000016b01ea3
- ? @ 0x00007ffff7f9b609
- ? @ 0x00007ffff7ec0353
[b3ea05351c88] 2026.03.22 07:31:42.903593 [ 718821 ] BaseDaemon: ########################################
[b3ea05351c88] 2026.03.22 07:31:42.903662 [ 718821 ] BaseDaemon: (version 24.12.2.1, build id: 60C09187FA5378AE17C5610B5842E0433D3A7D19, git hash: e067436) (from thread 718130) (query_id: 8f259dc4-a8c1-44fb-aa89-591e07ba8c20) (query: SELECT DISTINCT TOP 1 WITH TIES * FROM t0 ORDER BY tuple();) Received signal Aborted (6)
[b3ea05351c88] 2026.03.22 07:31:42.903694 [ 718821 ] BaseDaemon:
[b3ea05351c88] 2026.03.22 07:31:42.903717 [ 718821 ] BaseDaemon: Stack trace: 0x000000000c9c9488 0x000000000cc5b084 0x00007ffff7fa7420 0x00007ffff7de400c 0x00007ffff7dc3859 0x000000000c997ad9 0x000000000c998349 0x000000000719252c 0x00000000071954ab 0x00000000124f83cd 0x00000000124f3b71 0x00000000124ecdbc 0x00000000124eaeed 0x00000000127ceb36 0x00000000127ca201 0x0000000013f3a8a6 0x0000000013f517f9 0x0000000016b57807 0x0000000016b57cde 0x0000000016b04192 0x0000000016b01ea3 0x00007ffff7f9b609 0x00007ffff7ec0353
[b3ea05351c88] 2026.03.22 07:31:42.918503 [ 718821 ] BaseDaemon: 0.0. inlined from /home/fuzzer/ClickHouse/src/Common/StackTrace.cpp:381: StackTrace::tryCapture()
[b3ea05351c88] 2026.03.22 07:31:42.918535 [ 718821 ] BaseDaemon: 0. /home/fuzzer/ClickHouse/src/Common/StackTrace.cpp:350: StackTrace::StackTrace(ucontext_t const&) @ 0x000000000c9c9488
[b3ea05351c88] 2026.03.22 07:31:42.935037 [ 718821 ] BaseDaemon: 1. /home/fuzzer/ClickHouse/src/Common/SignalHandlers.cpp:102: signalHandler(int, siginfo_t*, void*) @ 0x000000000cc5b084
[b3ea05351c88] 2026.03.22 07:31:42.935079 [ 718821 ] BaseDaemon: 2. ? @ 0x00007ffff7fa7420
[b3ea05351c88] 2026.03.22 07:31:42.935104 [ 718821 ] BaseDaemon: 3. ? @ 0x00007ffff7de400c
[b3ea05351c88] 2026.03.22 07:31:42.935129 [ 718821 ] BaseDaemon: 4. ? @ 0x00007ffff7dc3859
[b3ea05351c88] 2026.03.22 07:31:42.962403 [ 718821 ] BaseDaemon: 5. /home/fuzzer/ClickHouse/src/Common/Exception.cpp:48: DB::abortOnFailedAssertion(String const&, void* const*, unsigned long, unsigned long) @ 0x000000000c997ad9
[b3ea05351c88] 2026.03.22 07:31:42.988782 [ 718821 ] BaseDaemon: 6.0. inlined from /home/fuzzer/ClickHouse/src/Common/Exception.cpp:70: DB::handle_error_code(String const&, int, bool, std::vector<void*, std::allocator<void*>> const&)
[b3ea05351c88] 2026.03.22 07:31:42.988818 [ 718821 ] BaseDaemon: 6. /home/fuzzer/ClickHouse/src/Common/Exception.cpp:111: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000c998349
[b3ea05351c88] 2026.03.22 07:31:43.002001 [ 718821 ] BaseDaemon: 7.0. inlined from /home/fuzzer/ClickHouse/src/Common/Exception.h:105: Exception
[b3ea05351c88] 2026.03.22 07:31:43.002024 [ 718821 ] BaseDaemon: 7. /home/fuzzer/ClickHouse/src/Common/Exception.h:58: DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000719252c
[b3ea05351c88] 2026.03.22 07:31:43.016735 [ 718821 ] BaseDaemon: 8. /home/fuzzer/ClickHouse/src/Common/Exception.h:123: DB::Exception::Exception<>(int, FormatStringHelperImpl<>) @ 0x00000000071954ab
[b3ea05351c88] 2026.03.22 07:31:43.094004 [ 718821 ] BaseDaemon: 9. /home/fuzzer/ClickHouse/src/Planner/Planner.cpp:1093: DB::(anonymous namespace)::addLimitStep(DB::QueryPlan&, DB::(anonymous namespace)::QueryAnalysisResult const&, std::shared_ptrDB::PlannerContext const&, DB::QueryNode const&) @ 0x00000000124f83cd
[b3ea05351c88] 2026.03.22 07:31:43.147028 [ 718821 ] BaseDaemon: 10. /home/fuzzer/ClickHouse/src/Planner/Planner.cpp:1800: DB::Planner::buildPlanForQueryNode() @ 0x00000000124f3b71
[b3ea05351c88] 2026.03.22 07:31:43.195800 [ 718821 ] BaseDaemon: 11. /home/fuzzer/ClickHouse/src/Planner/Planner.cpp:1300: DB::Planner::buildQueryPlanIfNeeded() @ 0x00000000124ecdbc
[b3ea05351c88] 2026.03.22 07:31:43.220337 [ 718821 ] BaseDaemon: 12. /home/fuzzer/ClickHouse/src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:241: DB::InterpreterSelectQueryAnalyzer::getQueryPlan() @ 0x00000000124eaeed
[b3ea05351c88] 2026.03.22 07:31:43.281341 [ 718821 ] BaseDaemon: 13. /home/fuzzer/ClickHouse/src/Interpreters/executeQuery.cpp:1317: DB::executeQueryImpl(char const*, char const*, std::shared_ptrDB::Context, DB::QueryFlags, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) @ 0x00000000127ceb36
[b3ea05351c88] 2026.03.22 07:31:43.348639 [ 718821 ] BaseDaemon: 14. /home/fuzzer/ClickHouse/src/Interpreters/executeQuery.cpp:1535: DB::executeQuery(String const&, std::shared_ptrDB::Context, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x00000000127ca201
[b3ea05351c88] 2026.03.22 07:31:43.390320 [ 718821 ] BaseDaemon: 15. /home/fuzzer/ClickHouse/src/Server/TCPHandler.cpp:656: DB::TCPHandler::runImpl() @ 0x0000000013f3a8a6
[b3ea05351c88] 2026.03.22 07:31:43.458578 [ 718821 ] BaseDaemon: 16. /home/fuzzer/ClickHouse/src/Server/TCPHandler.cpp:2603: DB::TCPHandler::run() @ 0x0000000013f517f9
[b3ea05351c88] 2026.03.22 07:31:43.460885 [ 718821 ] BaseDaemon: 17. /home/fuzzer/ClickHouse/base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x0000000016b57807
[b3ea05351c88] 2026.03.22 07:31:43.464611 [ 718821 ] BaseDaemon: 18. /home/fuzzer/ClickHouse/base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x0000000016b57cde
[b3ea05351c88] 2026.03.22 07:31:43.468761 [ 718821 ] BaseDaemon: 19. /home/fuzzer/ClickHouse/base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x0000000016b04192
[b3ea05351c88] 2026.03.22 07:31:43.472728 [ 718821 ] BaseDaemon: 20. /home/fuzzer/ClickHouse/base/poco/Foundation/src/Thread_POSIX.cpp:335: Poco::ThreadImpl::runnableEntry(void*) @ 0x0000000016b01ea3
[b3ea05351c88] 2026.03.22 07:31:43.472746 [ 718821 ] BaseDaemon: 21. ? @ 0x00007ffff7f9b609
[b3ea05351c88] 2026.03.22 07:31:43.472758 [ 718821 ] BaseDaemon: 22. ? @ 0x00007ffff7ec0353
[b3ea05351c88] 2026.03.22 07:31:43.472782 [ 718821 ] BaseDaemon: Integrity check of the executable skipped because the reference checksum could not be read.
[b3ea05351c88] 2026.03.22 07:31:43.472819 [ 718821 ] BaseDaemon: This ClickHouse version is not official and should be upgraded to the official build.
[b3ea05351c88] 2026.03.22 07:31:43.472918 [ 718821 ] BaseDaemon: No settings were changed
Error on processing query: Code: 32. DB::Exception: Attempt to read after eof: while receiving packet from localhost:9000. (ATTEMPT_TO_READ_AFTER_EOF) (version 24.12.2.1)
(query: SELECT DISTINCT TOP 1 WITH TIES * FROM t0 ORDER BY tuple();)
Activity
alexey-milovidov commentedon Mar 22, 2026
Closing: this was reported against v24.12 which is no longer supported. If the issue reproduces on a current version, please reopen with updated details.
alexey-milovidov commentedon Mar 22, 2026
Tested with the debug build of the current master (v26.4.1.1). The issue does not reproduce — the query either returns a proper error or completes without assertion failure.
Add regression test for fuzz issues reported against obsolete version