Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault in serialization after grouping with LowCardinality column #44221

Closed
metelitsaas opened this issue Dec 14, 2022 · 7 comments · Fixed by #44346
Closed

Segmentation fault in serialization after grouping with LowCardinality column #44221

metelitsaas opened this issue Dec 14, 2022 · 7 comments · Fixed by #44346
Assignees
Labels
bug Confirmed user-visible misbehaviour in official release crash Crash / segfault / abort major

Comments

@metelitsaas
Copy link

Describe what's wrong

ClickHouse crashes with a complex cast expression in grouping statement if the query is made via JDBC (with DBeaver). Correctly throws an exception if the query is made via clickhouse-client.

How to reproduce

ClickHouse version: 22.6.3.35
DBeaver: 21.2.1.202109181446
Driver: clickhouse-jdbc v0.2.6

Query via JDBC:

select
multiIf('all' IN ('all'), 'all', id) as case_value,
count(*)
from
(
    select materialize(toLowCardinality('test_value')) as id
    from numbers_mt(1000000)
)
group by case_value
;

clickhouse-server[3664505]: 2022.12.14 11:30:53.460283 [ 3667110 ] {} <Fatal> BaseDaemon: ########################################
clickhouse-server[3664505]: 2022.12.14 11:30:53.460347 [ 3667110 ] {} <Fatal> BaseDaemon: (version 22.6.3.35 (official build), build id: ECE208880769F062) (from thread 3664624) (query_id: 9b227031-b105-4d3d-866e-dcb31b08242f) (query: select case when 'all' in ('all') then 'all' else id end as case_value, count(*) from ( select materialize(toLowCardinality('test_value')) as id from numbers_mt(1000000) ) group by case_value FORMAT TabSeparatedWithNamesAndTypes;) Received signal Segmentation fault (11)
clickhouse-server[3664505]: 2022.12.14 11:30:53.460378 [ 3667110 ] {} <Fatal> BaseDaemon: Address: 0x1 Access: read. Address not mapped to object.
clickhouse-server[3664505]: 2022.12.14 11:30:53.460387 [ 3667110 ] {} <Fatal> BaseDaemon: Stack trace: 0xb8b5cc0 0x171b9cda 0x171b9820 0x1728d4b7 0xb94fbea 0xb951bc5 0xb94d577 0xb95099d 0x7fd2cb044609 0x7fd2caf69133
clickhouse-server[3664505]: 2022.12.14 11:30:53.460448 [ 3667110 ] {} <Fatal> BaseDaemon: 2. void DB::writeAnyEscapedString<(char)39, false>(char const*, char const*, DB::WriteBuffer&) @ 0xb8b5cc0 in /usr/bin/clickhouse
clickhouse-server[3664505]: 2022.12.14 11:30:53.460473 [ 3667110 ] {} <Fatal> BaseDaemon: 3. DB::IRowOutputFormat::write(std::__1::vector<COW<DB::IColumn>::immutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::immutable_ptr<DB::IColumn> > > const&, unsigned long) @ 0x171b9cda in /usr/bin/clickhouse
clickhouse-server[3664505]: 2022.12.14 11:30:53.460488 [ 3667110 ] {} <Fatal> BaseDaemon: 4. DB::IRowOutputFormat::consume(DB::Chunk) @ 0x171b9820 in /usr/bin/clickhouse
clickhouse-server[3664505]: 2022.12.14 11:30:53.460499 [ 3667110 ] {} <Fatal> BaseDaemon: 5. DB::ParallelFormattingOutputFormat::formatterThreadFunction(unsigned long, unsigned long, std::__1::shared_ptr<DB::ThreadGroupStatus> const&) @ 0x1728d4b7 in /usr/bin/clickhouse
clickhouse-server[3664505]: 2022.12.14 11:30:53.460510 [ 3667110 ] {} <Fatal> BaseDaemon: 6. ThreadPoolImpl<ThreadFromGlobalPool>::worker(std::__1::__list_iterator<ThreadFromGlobalPool, void*>) @ 0xb94fbea in /usr/bin/clickhouse
clickhouse-server[3664505]: 2022.12.14 11:30:53.460530 [ 3667110 ] {} <Fatal> BaseDaemon: 7. ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&)::'lambda'()::operator()() @ 0xb951bc5 in /usr/bin/clickhouse
clickhouse-server[3664505]: 2022.12.14 11:30:53.460540 [ 3667110 ] {} <Fatal> BaseDaemon: 8. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0xb94d577 in /usr/bin/clickhouse
clickhouse-server[3664505]: 2022.12.14 11:30:53.460547 [ 3667110 ] {} <Fatal> BaseDaemon: 9. ? @ 0xb95099d in /usr/bin/clickhouse
clickhouse-server[3664505]: 2022.12.14 11:30:53.460556 [ 3667110 ] {} <Fatal> BaseDaemon: 10. ? @ 0x7fd2cb044609 in ?
clickhouse-server[3664505]: 2022.12.14 11:30:53.460563 [ 3667110 ] {} <Fatal> BaseDaemon: 11. clone @ 0x7fd2caf69133 in ?
clickhouse-server[3664505]: 2022.12.14 11:30:53.587930 [ 3667110 ] {} <Fatal> BaseDaemon: Integrity check of the executable successfully passed (checksum: 43DE7A9BAAEC2325B42A8F250F4A2C22)

Query via clickhouse-client:

SELECT
    multiIf('all' IN ('all'), 'all', id) AS case_value,
    count(*)
FROM
(
    SELECT materialize(toLowCardinality('test_value')) AS id
    FROM numbers_mt(1000000)
)
GROUP BY case_value

Query id: b7e878f3-2b0e-461d-808e-504daf2e6459

0 rows in set. Elapsed: 0.005 sec.

Received exception from server (version 22.6.3):
Code: 49. DB::Exception: Received from localhost:9000. DB::Exception: Bad cast from type DB::ColumnLowCardinality to DB::ColumnString. (LOGICAL_ERROR)

Expected behavior

Expected that ClickHouse will not crash with segmentation fault if the query is made via JDBC.

@metelitsaas metelitsaas added the potential bug To be reviewed by developers and confirmed/rejected. label Dec 14, 2022
@tavplubix
Copy link
Member

tavplubix commented Dec 14, 2022

Reproduced (with clickhouse-client)

2022.12.14 14:11:54.827553 [ 526872 ] {0fbefbc7-1f6d-4d82-9756-883edda57c25} <Fatal> : Logical error: 'Bad cast from type DB::ColumnLowCardinality to DB::ColumnString'.
2022.12.14 14:11:54.833970 [ 554860 ] {} <Fatal> BaseDaemon: ########################################
2022.12.14 14:11:54.834211 [ 554860 ] {} <Fatal> BaseDaemon: (version 22.12.1.1, build id: D0D9ECCDD6D1EFFD5A4A34455067A0A94AC1C8E8) (from thread 526872) (query_id: 0fbefbc7-1f6d-4d82-9756-883edda57c25) (query: select multiIf('all' IN ('all'), 'all', id) as case_value, count(*) from ( select materialize(toLowCardinality('test_value')) as id from numbers_mt(1000000) ) group by case_value ;) Received signal Aborted (6)
2022.12.14 14:11:54.834774 [ 554860 ] {} <Fatal> BaseDaemon: 
2022.12.14 14:11:54.834941 [ 554860 ] {} <Fatal> BaseDaemon: Stack trace: 0x7fdbac58c64c 0x7fdbac53c958 0x7fdbac52653d 0x22d159b7 0x22d15a75 0x22d15bd2 0x19460cf7 0x22eefb40 0x2ac783e8 0x2abeff22 0x2daa0eee 0x2daa0bf9 0x2da56e95 0x2da54a19 0x2da4d099 0x2da5ddd2 0x32f9ea59 0x32f9f2c8 0x33237b81 0x3323407a 0x33232d15 0x7fdbac58a8fd 0x7fdbac60ca60
2022.12.14 14:11:54.835095 [ 554860 ] {} <Fatal> BaseDaemon: 4. ? @ 0x7fdbac58c64c in ?
2022.12.14 14:11:54.835669 [ 554860 ] {} <Fatal> BaseDaemon: 5. raise @ 0x7fdbac53c958 in ?
2022.12.14 14:11:54.835845 [ 554860 ] {} <Fatal> BaseDaemon: 6. abort @ 0x7fdbac52653d in ?
2022.12.14 14:11:55.037742 [ 554860 ] {} <Fatal> BaseDaemon: 7. /home/tavplubix/ch/ClickHouse/src/Common/Exception.cpp:41: DB::abortOnFailedAssertion(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) @ 0x22d159b7 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:55.136244 [ 554860 ] {} <Fatal> BaseDaemon: 8. /home/tavplubix/ch/ClickHouse/src/Common/Exception.cpp:64: DB::handle_error_code(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int, bool, std::__1::vector<void*, std::__1::allocator<void*>> const&) @ 0x22d15a75 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:55.226998 [ 554860 ] {} <Fatal> BaseDaemon: 9. /home/tavplubix/ch/ClickHouse/src/Common/Exception.cpp:78: DB::Exception::Exception(DB::Exception::MessageMasked const&, int, bool) @ 0x22d15bd2 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:55.317530 [ 554860 ] {} <Fatal> BaseDaemon: 10. /home/tavplubix/ch/ClickHouse/src/Common/Exception.h:41: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int, bool) @ 0x19460cf7 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:55.609995 [ 554860 ] {} <Fatal> BaseDaemon: 11. /home/tavplubix/ch/ClickHouse/src/Common/typeid_cast.h:40: DB::ColumnString const& typeid_cast<DB::ColumnString const&, DB::IColumn const>(DB::IColumn const&) @ 0x22eefb40 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:55.694216 [ 554860 ] {} <Fatal> BaseDaemon: 12. /home/tavplubix/ch/ClickHouse/src/DataTypes/Serializations/SerializationString.cpp:119: DB::SerializationString::serializeBinaryBulk(DB::IColumn const&, DB::WriteBuffer&, unsigned long, unsigned long) const @ 0x2ac783e8 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:55.772110 [ 554860 ] {} <Fatal> BaseDaemon: 13. /home/tavplubix/ch/ClickHouse/src/DataTypes/Serializations/ISerialization.cpp:115: DB::ISerialization::serializeBinaryBulkWithMultipleStreams(DB::IColumn const&, unsigned long, unsigned long, DB::ISerialization::SerializeBinaryBulkSettings&, std::__1::shared_ptr<DB::ISerialization::SerializeBinaryBulkState>&) const @ 0x2abeff22 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:55.904536 [ 554860 ] {} <Fatal> BaseDaemon: 14. /home/tavplubix/ch/ClickHouse/src/Formats/NativeWriter.cpp:62: DB::writeData(DB::ISerialization const&, COW<DB::IColumn>::immutable_ptr<DB::IColumn> const&, DB::WriteBuffer&, unsigned long, unsigned long) @ 0x2daa0eee in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:55.991557 [ 554860 ] {} <Fatal> BaseDaemon: 15. /home/tavplubix/ch/ClickHouse/src/Formats/NativeWriter.cpp:151: DB::NativeWriter::write(DB::Block const&) @ 0x2daa0bf9 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:56.441586 [ 554860 ] {} <Fatal> BaseDaemon: 16. /home/tavplubix/ch/ClickHouse/src/Server/TCPHandler.cpp:1778: DB::TCPHandler::sendData(DB::Block const&) @ 0x2da56e95 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:56.732588 [ 554860 ] {} <Fatal> BaseDaemon: 17. /home/tavplubix/ch/ClickHouse/src/Server/TCPHandler.cpp:781: DB::TCPHandler::processOrdinaryQueryWithProcessors() @ 0x2da54a19 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:57.009630 [ 554860 ] {} <Fatal> BaseDaemon: 18. /home/tavplubix/ch/ClickHouse/src/Server/TCPHandler.cpp:388: DB::TCPHandler::runImpl() @ 0x2da4d099 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:57.306635 [ 554860 ] {} <Fatal> BaseDaemon: 19. /home/tavplubix/ch/ClickHouse/src/Server/TCPHandler.cpp:1902: DB::TCPHandler::run() @ 0x2da5ddd2 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:57.374495 [ 554860 ] {} <Fatal> BaseDaemon: 20. /home/tavplubix/ch/ClickHouse/contrib/poco/Net/src/TCPServerConnection.cpp:43: Poco::Net::TCPServerConnection::start() @ 0x32f9ea59 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:57.458554 [ 554860 ] {} <Fatal> BaseDaemon: 21. /home/tavplubix/ch/ClickHouse/contrib/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x32f9f2c8 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:57.556942 [ 554860 ] {} <Fatal> BaseDaemon: 22. /home/tavplubix/ch/ClickHouse/contrib/poco/Foundation/src/ThreadPool.cpp:199: Poco::PooledThread::run() @ 0x33237b81 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:57.641289 [ 554860 ] {} <Fatal> BaseDaemon: 23. /home/tavplubix/ch/ClickHouse/contrib/poco/Foundation/src/Thread.cpp:56: Poco::(anonymous namespace)::RunnableHolder::run() @ 0x3323407a in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:57.722004 [ 554860 ] {} <Fatal> BaseDaemon: 24. /home/tavplubix/ch/ClickHouse/contrib/poco/Foundation/src/Thread_POSIX.cpp:345: Poco::ThreadImpl::runnableEntry(void*) @ 0x33232d15 in /home/tavplubix/ch/ClickHouse/cmake-build-debug/programs/clickhouse
2022.12.14 14:11:57.722244 [ 554860 ] {} <Fatal> BaseDaemon: 25. ? @ 0x7fdbac58a8fd in ?
2022.12.14 14:11:57.722428 [ 554860 ] {} <Fatal> BaseDaemon: 26. ? @ 0x7fdbac60ca60 in ?
2022.12.14 14:11:57.722582 [ 554860 ] {} <Fatal> BaseDaemon: Integrity check of the executable skipped because the reference checksum could not be read.

@tavplubix tavplubix added bug Confirmed user-visible misbehaviour in official release crash Crash / segfault / abort and removed potential bug To be reviewed by developers and confirmed/rejected. labels Dec 14, 2022
@alexey-milovidov
Copy link
Member

alexey-milovidov commented Dec 15, 2022

On master, it produced a logical error exception, but does not crash:

$ clickhouse-client 
ClickHouse client version 22.12.1.1.
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 22.12.1 revision 54461.

milovidov-desktop :) select
                     multiIf('all' IN ('all'), 'all', id) as case_value,
                     count(*)
                     from
                     (
                         select materialize(toLowCardinality('test_value')) as id
                         from numbers_mt(1000000)
                     )
                     group by case_value
                     ;

SELECT
    multiIf('all' IN ('all'), 'all', id) AS case_value,
    count(*)
FROM
(
    SELECT materialize(toLowCardinality('test_value')) AS id
    FROM numbers_mt(1000000)
)
GROUP BY case_value

Query id: 8dfc7302-5269-4679-a722-21148a1e2f4a


0 rows in set. Elapsed: 0.010 sec. 

Received exception from server (version 22.12.1):
Code: 49. DB::Exception: Received from localhost:9000. DB::Exception: Bad cast from type DB::ColumnLowCardinality to DB::ColumnString. (LOGICAL_ERROR)

@alexey-milovidov alexey-milovidov removed the crash Crash / segfault / abort label Dec 15, 2022
@alexey-milovidov alexey-milovidov changed the title Segmentation fault in grouping with LowCardinality column Logical error in grouping with LowCardinality column Dec 15, 2022
@tavplubix
Copy link
Member

It crashes with SIGSEGV if you send the query through HTTP interface:

2022.12.15 12:47:45.145815 [ 666892 ] {} <Fatal> BaseDaemon: ########################################
2022.12.15 12:47:45.145902 [ 666892 ] {} <Fatal> BaseDaemon: (version 22.12.1.1733 (official build), build id: 186EC839B691BAFCB9D2B811DF38850FE3263C4F) (from thread 666799) (query_id: d086aea4-461a-4ec1-b7ae-626c0bbe2fd6) (query: select multiIf('all' IN ('all'), 'all', id) as case_value, count(*) from ( select materialize(toLowCardinality('test_value')) as id from numbers_mt(1000000) ) group by case_value ;) Received signal Segmentation fault (11)
2022.12.15 12:47:45.145960 [ 666892 ] {} <Fatal> BaseDaemon: Address: 0x7f594640d000 Access: read. Attempted access has violated the permissions assigned to the memory area.
2022.12.15 12:47:45.145993 [ 666892 ] {} <Fatal> BaseDaemon: Stack trace: 0x8fcf5c0 0x154b9d08 0x153f6bbc 0x153f6740 0x154e4f80 0xe809096 0xe80b8b5 0xe8056b6 0xe80a881 0x7f59e06a78fd 0x7f59e0729a60
2022.12.15 12:47:45.866344 [ 666892 ] {} <Fatal> BaseDaemon: 2. DB::writeJSONString(char const*, char const*, DB::WriteBuffer&, DB::FormatSettings const&) @ 0x8fcf5c0 in /home/tavplubix/ch/logs/clickhouse
2022.12.15 12:47:45.879468 [ 666892 ] {} <Fatal> BaseDaemon: 3. ./build_docker/../src/Processors/Formats/Impl/JSONCompactRowOutputFormat.cpp:24: DB::JSONCompactRowOutputFormat::writeField(DB::IColumn const&, DB::ISerialization const&, unsigned long) @ 0x154b9d08 in /home/tavplubix/ch/logs/clickhouse
2022.12.15 12:47:45.884353 [ 666892 ] {} <Fatal> BaseDaemon: 4. ./build_docker/../src/Processors/Formats/IRowOutputFormat.cpp:78: DB::IRowOutputFormat::write(std::__1::vector<COW<DB::IColumn>::immutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::immutable_ptr<DB::IColumn>>> const&, unsigned long) @ 0x153f6bbc in /home/tavplubix/ch/logs/clickhouse
2022.12.15 12:47:45.887467 [ 666892 ] {} <Fatal> BaseDaemon: 5.1. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/__functional/function.h:863: std::__1::__function::__policy_func<void (std::__1::vector<COW<DB::IColumn>::immutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::immutable_ptr<DB::IColumn>>> const&, unsigned long)>::operator bool[abi:v15000]() const
2022.12.15 12:47:45.887483 [ 666892 ] {} <Fatal> BaseDaemon: 5.2. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/__functional/function.h:1039: std::__1::function<void (std::__1::vector<COW<DB::IColumn>::immutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::immutable_ptr<DB::IColumn>>> const&, unsigned long)>::operator bool[abi:v15000]() const
2022.12.15 12:47:45.887495 [ 666892 ] {} <Fatal> BaseDaemon: 5. ./build_docker/../src/Processors/Formats/IRowOutputFormat.cpp:34: DB::IRowOutputFormat::consume(DB::Chunk) @ 0x153f6740 in /home/tavplubix/ch/logs/clickhouse
2022.12.15 12:47:45.894675 [ 666892 ] {} <Fatal> BaseDaemon: 6.1. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:701: ~shared_ptr
2022.12.15 12:47:45.894694 [ 666892 ] {} <Fatal> BaseDaemon: 6.2. inlined from ./build_docker/../src/Processors/Chunk.h:32: ~Chunk
2022.12.15 12:47:45.894700 [ 666892 ] {} <Fatal> BaseDaemon: 6. ./build_docker/../src/Processors/Formats/Impl/ParallelFormattingOutputFormat.cpp:197: DB::ParallelFormattingOutputFormat::formatterThreadFunction(unsigned long, unsigned long, std::__1::shared_ptr<DB::ThreadGroupStatus> const&) @ 0x154e4f80 in /home/tavplubix/ch/logs/clickhouse
2022.12.15 12:47:45.903256 [ 666892 ] {} <Fatal> BaseDaemon: 7.1. inlined from ./build_docker/../base/base/wide_integer_impl.h:786: bool wide::integer<128ul, unsigned int>::_impl::operator_eq<wide::integer<128ul, unsigned int>>(wide::integer<128ul, unsigned int> const&, wide::integer<128ul, unsigned int> const&)
2022.12.15 12:47:45.903279 [ 666892 ] {} <Fatal> BaseDaemon: 7.2. inlined from ./build_docker/../base/base/wide_integer_impl.h:1453: bool wide::operator==<128ul, unsigned int, 128ul, unsigned int>(wide::integer<128ul, unsigned int> const&, wide::integer<128ul, unsigned int> const&)
2022.12.15 12:47:45.903285 [ 666892 ] {} <Fatal> BaseDaemon: 7.3. inlined from ./build_docker/../base/base/strong_typedef.h:42: StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag>::operator==(StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag> const&) const
2022.12.15 12:47:45.903322 [ 666892 ] {} <Fatal> BaseDaemon: 7.4. inlined from ./build_docker/../src/Common/OpenTelemetryTraceContext.h:39: DB::OpenTelemetry::Span::isTraceEnabled() const
2022.12.15 12:47:45.903326 [ 666892 ] {} <Fatal> BaseDaemon: 7. ./build_docker/../src/Common/ThreadPool.cpp:296: ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>::worker(std::__1::__list_iterator<ThreadFromGlobalPoolImpl<false>, void*>) @ 0xe809096 in /home/tavplubix/ch/logs/clickhouse
2022.12.15 12:47:45.912172 [ 666892 ] {} <Fatal> BaseDaemon: 8.1. inlined from ./build_docker/../src/Common/ThreadPool.cpp:0: operator()
2022.12.15 12:47:45.912213 [ 666892 ] {} <Fatal> BaseDaemon: 8.2. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/__functional/invoke.h:394: decltype(std::declval<void>()()) std::__1::__invoke[abi:v15000]<ThreadFromGlobalPoolImpl<false>::ThreadFromGlobalPoolImpl<void ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::'lambda0'()>(void&&)::'lambda'()&>(void&&)
2022.12.15 12:47:45.912239 [ 666892 ] {} <Fatal> BaseDaemon: 8.3. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/__functional/invoke.h:479: void std::__1::__invoke_void_return_wrapper<void, true>::__call<ThreadFromGlobalPoolImpl<false>::ThreadFromGlobalPoolImpl<void ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::'lambda0'()>(void&&)::'lambda'()&>(ThreadFromGlobalPoolImpl<false>::ThreadFromGlobalPoolImpl<void ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::'lambda0'()>(void&&)::'lambda'()&)
2022.12.15 12:47:45.912248 [ 666892 ] {} <Fatal> BaseDaemon: 8.4. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/__functional/function.h:235: std::__1::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<false>::ThreadFromGlobalPoolImpl<void ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::'lambda0'()>(void&&)::'lambda'(), void ()>::operator()[abi:v15000]()
2022.12.15 12:47:45.912253 [ 666892 ] {} <Fatal> BaseDaemon: 8. ./build_docker/../contrib/llvm-project/libcxx/include/__functional/function.h:716: void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<false>::ThreadFromGlobalPoolImpl<void ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::'lambda0'()>(void&&)::'lambda'(), void ()>>(std::__1::__function::__policy_storage const*) @ 0xe80b8b5 in /home/tavplubix/ch/logs/clickhouse
2022.12.15 12:47:45.918119 [ 666892 ] {} <Fatal> BaseDaemon: 9.1. inlined from ./build_docker/../base/base/wide_integer_impl.h:786: bool wide::integer<128ul, unsigned int>::_impl::operator_eq<wide::integer<128ul, unsigned int>>(wide::integer<128ul, unsigned int> const&, wide::integer<128ul, unsigned int> const&)
2022.12.15 12:47:45.918134 [ 666892 ] {} <Fatal> BaseDaemon: 9.2. inlined from ./build_docker/../base/base/wide_integer_impl.h:1453: bool wide::operator==<128ul, unsigned int, 128ul, unsigned int>(wide::integer<128ul, unsigned int> const&, wide::integer<128ul, unsigned int> const&)
2022.12.15 12:47:45.918140 [ 666892 ] {} <Fatal> BaseDaemon: 9.3. inlined from ./build_docker/../base/base/strong_typedef.h:42: StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag>::operator==(StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag> const&) const
2022.12.15 12:47:45.918145 [ 666892 ] {} <Fatal> BaseDaemon: 9.4. inlined from ./build_docker/../src/Common/OpenTelemetryTraceContext.h:39: DB::OpenTelemetry::Span::isTraceEnabled() const
2022.12.15 12:47:45.918161 [ 666892 ] {} <Fatal> BaseDaemon: 9. ./build_docker/../src/Common/ThreadPool.cpp:296: ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0xe8056b6 in /home/tavplubix/ch/logs/clickhouse
2022.12.15 12:47:45.927489 [ 666892 ] {} <Fatal> BaseDaemon: 10.1. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:302: std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>::reset[abi:v15000](std::__1::__thread_struct*)
2022.12.15 12:47:45.927506 [ 666892 ] {} <Fatal> BaseDaemon: 10.2. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:259: ~unique_ptr
2022.12.15 12:47:45.927511 [ 666892 ] {} <Fatal> BaseDaemon: 10.3. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/tuple:265: ~__tuple_leaf
2022.12.15 12:47:45.927517 [ 666892 ] {} <Fatal> BaseDaemon: 10.4. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/tuple:538: ~tuple
2022.12.15 12:47:45.927525 [ 666892 ] {} <Fatal> BaseDaemon: 10.5. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:48: std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::'lambda0'()>>::operator()[abi:v15000](std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::'lambda0'()>*) const
2022.12.15 12:47:45.927536 [ 666892 ] {} <Fatal> BaseDaemon: 10.6. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:305: std::__1::unique_ptr<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::'lambda0'()>, std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::'lambda0'()>>>::reset[abi:v15000](std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::'lambda0'()>*)
2022.12.15 12:47:45.927570 [ 666892 ] {} <Fatal> BaseDaemon: 10.7. inlined from ./build_docker/../contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:259: ~unique_ptr
2022.12.15 12:47:45.927576 [ 666892 ] {} <Fatal> BaseDaemon: 10. ./build_docker/../contrib/llvm-project/libcxx/include/thread:297: void* std::__1::__thread_proxy[abi:v15000]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::'lambda0'()>>(void*) @ 0xe80a881 in /home/tavplubix/ch/logs/clickhouse
2022.12.15 12:47:45.927586 [ 666892 ] {} <Fatal> BaseDaemon: 11. ? @ 0x7f59e06a78fd in ?
2022.12.15 12:47:45.927593 [ 666892 ] {} <Fatal> BaseDaemon: 12. ? @ 0x7f59e0729a60 in ?
2022.12.15 12:47:46.084946 [ 666892 ] {} <Fatal> BaseDaemon: Integrity check of the executable successfully passed (checksum: E2B82A11D0141CECB60FF62C9E47A2F7)

@tavplubix tavplubix added crash Crash / segfault / abort bug Confirmed user-visible misbehaviour in official release and removed bug Confirmed user-visible misbehaviour in official release labels Dec 15, 2022
@tavplubix tavplubix changed the title Logical error in grouping with LowCardinality column Segmentation fault in serialization after grouping with LowCardinality column Dec 15, 2022
@alexey-milovidov
Copy link
Member

curl http://localhost:8123/ --data-binary "select multiIf('all' IN ('all'), 'all', id) as case_value, count(*) from ( select materialize(toLowCardinality('test_value')) as id from numbers_mt(1000000) ) group by case_value"

@alexey-milovidov
Copy link
Member

SELECT if(1 IN 1, 'a', toLowCardinality('')) AS x GROUP BY x

@alexey-milovidov
Copy link
Member

milovidov-desktop :) SELECT toTypeName(x), dumpColumnStructure(x) FROM (SELECT if(1 IN 1, 'a', toLowCardinality('')) AS x GROUP BY x)

┌─toTypeName(x)─┬─dumpColumnStructure(x)────────────────────────────────────────────────────────────────────────────────────────────┐
│ String        │ LowCardinality(String), ColumnLowCardinality(size = 1, UInt8(size = 1), ColumnUnique(size = 2, String(size = 2))) │
└───────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

@alexey-milovidov
Copy link
Member

This issue is also fixed by Analyzer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed user-visible misbehaviour in official release crash Crash / segfault / abort major
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants