Skip to content

Server crash with groupArraySample(5)(distinct ...) #17682

@mzealey

Description

@mzealey

Describe the bug

SELECT
    domain 
    , groupArraySample(5)(distinct subdomain) AS example_subdomains
FROM table
WHERE time > now() - interval 1 hour
GROUP BY domain
LIMIT 100

Causes a server crash. If I remove the distinct it runs just fine. I appreciate it is probably not valid to use a distinct here, but it should not cause a full crash.

[clickhouse] 2020.12.01 13:06:12.037997 [ 265 ] <Fatal> BaseDaemon: ########################################
[clickhouse] 2020.12.01 13:06:12.038106 [ 265 ] <Fatal> BaseDaemon: (version 20.11.3.3 (official build), build id: C88CD350740ED614) (from thread 165) (query_id: a94ba7b7-f82d-4d0e-ba0a-af0763003728) Received signal Segmentation fault (11)
[clickhouse] 2020.12.01 13:06:12.038131 [ 265 ] <Fatal> BaseDaemon: Address: NULL pointer. Access: read. Address not mapped to object.
[clickhouse] 2020.12.01 13:06:12.038162 [ 265 ] <Fatal> BaseDaemon: Stack trace: 0x7dc0763 0x91da3ea 0xdab6dda 0xdabafeb 0xdabac8b 0xdaba3f5 0xda42adf 0xe4eb128 0xe34e96a 0xe38774c 0xe384877 0xe389825 0x7b6293d 0x7b66463 0x7f6507933609 0x7f6507849293
[clickhouse] 2020.12.01 13:06:12.038136 [ 264 ] <Fatal> BaseDaemon: ########################################
[clickhouse] 2020.12.01 13:06:12.038228 [ 264 ] <Fatal> BaseDaemon: (version 20.11.3.3 (official build), build id: C88CD350740ED614) (from thread 175) (query_id: a94ba7b7-f82d-4d0e-ba0a-af0763003728) Received signal Segmentation fault (11)
[clickhouse] 2020.12.01 13:06:12.038267 [ 265 ] <Fatal> BaseDaemon: 2. DB::GroupArrayGeneralImpl<DB::GroupArrayNodeString, DB::GroupArrayTrait<true, (DB::Sampler)1> >::insertResultInto(char*, DB::IColumn&, DB::Arena*) const @ 0x7dc0763 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038282 [ 264 ] <Fatal> BaseDaemon: Address: 0x6 Access: read. Address not mapped to object.
[clickhouse] 2020.12.01 13:06:12.038311 [ 265 ] <Fatal> BaseDaemon: 3. DB::AggregateFunctionDistinct<DB::AggregateFunctionDistinctSingleGenericData<true> >::insertResultInto(char*, DB::IColumn&, DB::Arena*) const @ 0x91da3ea in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038318 [ 264 ] <Fatal> BaseDaemon: Stack trace: 0x7dc0763 0x91da3ea 0xdab6dda 0xdabafeb 0xdabac8b 0xdaba3f5 0xda42adf 0xe4eb128 0xe34e96a 0xe38774c 0xe384877 0xe389825 0x7b6293d 0x7b66463 0x7f6507933609 0x7f6507849293
[clickhouse] 2020.12.01 13:06:12.038342 [ 265 ] <Fatal> BaseDaemon: 4. void DB::Aggregator::insertAggregatesIntoColumns<char*>(char*&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::Arena*) const @ 0xdab6dda in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038386 [ 265 ] <Fatal> BaseDaemon: 5. void DB::Aggregator::convertToBlockImplFinal<DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >, StringHashMap<char*, Allocator<true, true> > >(DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >&, StringHashMap<char*, Allocator<true, true> >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::Arena*) const @ 0xdabafeb in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038456 [ 265 ] <Fatal> BaseDaemon: 6. void DB::Aggregator::convertToBlockImpl<DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >, StringHashMap<char*, Allocator<true, true> > >(DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >&, StringHashMap<char*, Allocator<true, true> >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<DB::PODArray<char*, 4096ul, Allocator<false, false>, 15ul, 16ul>*, std::__1::allocator<DB::PODArray<char*, 4096ul, Allocator<false, false>, 15ul, 16ul>*> >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::Arena*, bool) const @ 0xdabac8b in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038223 [ 266 ] <Fatal> BaseDaemon: ########################################
[clickhouse] 2020.12.01 13:06:12.038562 [ 265 ] <Fatal> BaseDaemon: 7. DB::Block DB::Aggregator::prepareBlockAndFill<DB::Block DB::Aggregator::convertOneBucketToBlock<DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> > >(DB::AggregatedDataVariants&, DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >&, bool, unsigned long) const::'lambda'(std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<DB::PODArray<char*, 4096ul, Allocator<false, false>, 15ul, 16ul>*, std::__1::allocator<DB::PODArray<char*, 4096ul, Allocator<false, false>, 15ul, 16ul>*> >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::Arena*, bool)>(DB::AggregatedDataVariants&, bool, unsigned long, DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >&&) const @ 0xdaba3f5 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038570 [ 266 ] <Fatal> BaseDaemon: (version 20.11.3.3 (official build), build id: C88CD350740ED614) (from thread 161) (query_id: a94ba7b7-f82d-4d0e-ba0a-af0763003728) Received signal Segmentation fault (11)
[clickhouse] 2020.12.01 13:06:12.038601 [ 265 ] <Fatal> BaseDaemon: 8. DB::Aggregator::mergeAndConvertOneBucketToBlock(std::__1::vector<std::__1::shared_ptr<DB::AggregatedDataVariants>, std::__1::allocator<std::__1::shared_ptr<DB::AggregatedDataVariants> > >&, DB::Arena*, bool, unsigned long, std::__1::atomic<bool>*) const @ 0xda42adf in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038607 [ 266 ] <Fatal> BaseDaemon: Address: 0x7 Access: read. Address not mapped to object.
[clickhouse] 2020.12.01 13:06:12.038632 [ 265 ] <Fatal> BaseDaemon: 9. DB::ConvertingAggregatedToChunksSource::generate() @ 0xe4eb128 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038646 [ 266 ] <Fatal> BaseDaemon: Stack trace: 0x7dc0763 0x91da3ea 0xdab6dda 0xdabb112 0xdabac8b 0xdaba3f5 0xda42adf 0xe4eb128 0xe34e96a 0xe38774c 0xe384877 0xe389825 0x7b6293d 0x7b66463 0x7f6507933609 0x7f6507849293
[clickhouse] 2020.12.01 13:06:12.038671 [ 265 ] <Fatal> BaseDaemon: 10. DB::ISource::work() @ 0xe34e96a in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038711 [ 265 ] <Fatal> BaseDaemon: 11. ? @ 0xe38774c in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038730 [ 266 ] <Fatal> BaseDaemon: 2. DB::GroupArrayGeneralImpl<DB::GroupArrayNodeString, DB::GroupArrayTrait<true, (DB::Sampler)1> >::insertResultInto(char*, DB::IColumn&, DB::Arena*) const @ 0x7dc0763 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038750 [ 265 ] <Fatal> BaseDaemon: 12. DB::PipelineExecutor::executeStepImpl(unsigned long, unsigned long, std::__1::atomic<bool>*) @ 0xe384877 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038770 [ 266 ] <Fatal> BaseDaemon: 3. DB::AggregateFunctionDistinct<DB::AggregateFunctionDistinctSingleGenericData<true> >::insertResultInto(char*, DB::IColumn&, DB::Arena*) const @ 0x91da3ea in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038795 [ 265 ] <Fatal> BaseDaemon: 13. ? @ 0xe389825 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038831 [ 266 ] <Fatal> BaseDaemon: 4. void DB::Aggregator::insertAggregatesIntoColumns<char*>(char*&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::Arena*) const @ 0xdab6dda in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038822 [ 265 ] <Fatal> BaseDaemon: 14. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x7b6293d in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038884 [ 265 ] <Fatal> BaseDaemon: 15. ? @ 0x7b66463 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038935 [ 265 ] <Fatal> BaseDaemon: 16. start_thread @ 0x9609 in /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
[clickhouse] 2020.12.01 13:06:12.038899 [ 266 ] <Fatal> BaseDaemon: 5. void DB::Aggregator::convertToBlockImplFinal<DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >, StringHashMap<char*, Allocator<true, true> > >(DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >&, StringHashMap<char*, Allocator<true, true> >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::Arena*) const @ 0xdabb112 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038992 [ 265 ] <Fatal> BaseDaemon: 17. clone @ 0x122293 in /usr/lib/x86_64-linux-gnu/libc-2.31.so
[clickhouse] 2020.12.01 13:06:12.039016 [ 266 ] <Fatal> BaseDaemon: 6. void DB::Aggregator::convertToBlockImpl<DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >, StringHashMap<char*, Allocator<true, true> > >(DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >&, StringHashMap<char*, Allocator<true, true> >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<DB::PODArray<char*, 4096ul, Allocator<false, false>, 15ul, 16ul>*, std::__1::allocator<DB::PODArray<char*, 4096ul, Allocator<false, false>, 15ul, 16ul>*> >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::Arena*, bool) const @ 0xdabac8b in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.038396 [ 264 ] <Fatal> BaseDaemon: 2. DB::GroupArrayGeneralImpl<DB::GroupArrayNodeString, DB::GroupArrayTrait<true, (DB::Sampler)1> >::insertResultInto(char*, DB::IColumn&, DB::Arena*) const @ 0x7dc0763 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039069 [ 266 ] <Fatal> BaseDaemon: 7. DB::Block DB::Aggregator::prepareBlockAndFill<DB::Block DB::Aggregator::convertOneBucketToBlock<DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> > >(DB::AggregatedDataVariants&, DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >&, bool, unsigned long) const::'lambda'(std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<DB::PODArray<char*, 4096ul, Allocator<false, false>, 15ul, 16ul>*, std::__1::allocator<DB::PODArray<char*, 4096ul, Allocator<false, false>, 15ul, 16ul>*> >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::Arena*, bool)>(DB::AggregatedDataVariants&, bool, unsigned long, DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >&&) const @ 0xdaba3f5 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039093 [ 264 ] <Fatal> BaseDaemon: 3. DB::AggregateFunctionDistinct<DB::AggregateFunctionDistinctSingleGenericData<true> >::insertResultInto(char*, DB::IColumn&, DB::Arena*) const @ 0x91da3ea in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039113 [ 266 ] <Fatal> BaseDaemon: 8. DB::Aggregator::mergeAndConvertOneBucketToBlock(std::__1::vector<std::__1::shared_ptr<DB::AggregatedDataVariants>, std::__1::allocator<std::__1::shared_ptr<DB::AggregatedDataVariants> > >&, DB::Arena*, bool, unsigned long, std::__1::atomic<bool>*) const @ 0xda42adf in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039147 [ 266 ] <Fatal> BaseDaemon: 9. DB::ConvertingAggregatedToChunksSource::generate() @ 0xe4eb128 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039152 [ 264 ] <Fatal> BaseDaemon: 4. void DB::Aggregator::insertAggregatesIntoColumns<char*>(char*&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::Arena*) const @ 0xdab6dda in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039211 [ 264 ] <Fatal> BaseDaemon: 5. void DB::Aggregator::convertToBlockImplFinal<DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >, StringHashMap<char*, Allocator<true, true> > >(DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >&, StringHashMap<char*, Allocator<true, true> >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::Arena*) const @ 0xdabafeb in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039178 [ 266 ] <Fatal> BaseDaemon: 10. DB::ISource::work() @ 0xe34e96a in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039281 [ 264 ] <Fatal> BaseDaemon: 6. void DB::Aggregator::convertToBlockImpl<DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >, StringHashMap<char*, Allocator<true, true> > >(DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >&, StringHashMap<char*, Allocator<true, true> >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<DB::PODArray<char*, 4096ul, Allocator<false, false>, 15ul, 16ul>*, std::__1::allocator<DB::PODArray<char*, 4096ul, Allocator<false, false>, 15ul, 16ul>*> >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::Arena*, bool) const @ 0xdabac8b in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039298 [ 266 ] <Fatal> BaseDaemon: 11. ? @ 0xe38774c in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039344 [ 264 ] <Fatal> BaseDaemon: 7. DB::Block DB::Aggregator::prepareBlockAndFill<DB::Block DB::Aggregator::convertOneBucketToBlock<DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> > >(DB::AggregatedDataVariants&, DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >&, bool, unsigned long) const::'lambda'(std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<DB::PODArray<char*, 4096ul, Allocator<false, false>, 15ul, 16ul>*, std::__1::allocator<DB::PODArray<char*, 4096ul, Allocator<false, false>, 15ul, 16ul>*> >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::Arena*, bool)>(DB::AggregatedDataVariants&, bool, unsigned long, DB::AggregationMethodStringNoCache<TwoLevelStringHashMap<char*, Allocator<true, true>, StringHashMap> >&&) const @ 0xdaba3f5 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039380 [ 266 ] <Fatal> BaseDaemon: 12. DB::PipelineExecutor::executeStepImpl(unsigned long, unsigned long, std::__1::atomic<bool>*) @ 0xe384877 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039382 [ 264 ] <Fatal> BaseDaemon: 8. DB::Aggregator::mergeAndConvertOneBucketToBlock(std::__1::vector<std::__1::shared_ptr<DB::AggregatedDataVariants>, std::__1::allocator<std::__1::shared_ptr<DB::AggregatedDataVariants> > >&, DB::Arena*, bool, unsigned long, std::__1::atomic<bool>*) const @ 0xda42adf in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039500 [ 266 ] <Fatal> BaseDaemon: 13. ? @ 0xe389825 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039585 [ 266 ] <Fatal> BaseDaemon: 14. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x7b6293d in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039702 [ 266 ] <Fatal> BaseDaemon: 15. ? @ 0x7b66463 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039691 [ 264 ] <Fatal> BaseDaemon: 9. DB::ConvertingAggregatedToChunksSource::generate() @ 0xe4eb128 in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039762 [ 266 ] <Fatal> BaseDaemon: 16. start_thread @ 0x9609 in /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
[clickhouse] 2020.12.01 13:06:12.039814 [ 266 ] <Fatal> BaseDaemon: 17. clone @ 0x122293 in /usr/lib/x86_64-linux-gnu/libc-2.31.so
[clickhouse] 2020.12.01 13:06:12.039771 [ 264 ] <Fatal> BaseDaemon: 10. DB::ISource::work() @ 0xe34e96a in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.039859 [ 264 ] <Fatal> BaseDaemon: 11. ? @ 0xe38774c in /usr/bin/clickhouse
[clickhouse] 2020.12.01 13:06:12.040261 [ 267 ] <Fatal> BaseDaemon: ########################################

Metadata

Metadata

Assignees

Labels

bugConfirmed user-visible misbehaviour in official releasecrashCrash / segfault / abort

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions