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

Crash Bug - Segmentation fault - Address: NULL pointer. Access: read. Unknown si_code. #45590

Closed
mignaulo opened this issue Jan 24, 2023 · 13 comments
Assignees
Labels
bug Confirmed user-visible misbehaviour in official release comp-projections crash Crash / segfault / abort major

Comments

@mignaulo
Copy link

Crash bug on ClickHouse server version 22.12.3.5 (official build), running on Ubuntu 22.04

2023.01.24 20:15:07.396001 [ 419381 ] {} <Fatal> BaseDaemon: ########################################
2023.01.24 20:15:07.396083 [ 419381 ] {} <Fatal> BaseDaemon: (version 22.12.3.5 (official build), build id: 1FC9EF37AB97BF195F9DF1C7D44CEC3DCC837FAD) (from thread 409241) (query_id: a86fef4a-d7fe-4046-8d30-49f6e5bb155b) (query:  with tt as ( Select cast(toStartOfInterval(timestamp, INTERVAL 1 day) as Date) as dd, count() as samples from db.table_live_v2 group by dd having dd >= toDate(now())-100 ), tt2 as ( Select dd, samples from tt union distinct Select toDate(now())-1, ifnull((select samples from tt where dd = toDate(now())-1),0) as samples ) Select dd, samples from tt2 order by dd WITH FILL STEP 1 ) Received signal Segmentation fault (11)
2023.01.24 20:15:07.396108 [ 419381 ] {} <Fatal> BaseDaemon: Address: NULL pointer. Access: read. Unknown si_code.
2023.01.24 20:15:07.396136 [ 419381 ] {} <Fatal> BaseDaemon: Stack trace: 0x13942618 0x1394188f 0x13908e88 0x139079ba 0x142e9b8a 0x142fb9d4 0x142efbaf 0x142eec6d 0x143896b4 0x142fbd64 0x142efbaf 0x142eec6d 0x143892e5 0x1438a2fe 0x14692bb0 0x1468fdad 0x1538858f 0x1539be59 0x1821ac34 0x1821c5db 0x183ab6c7 0x183a90fd 0x7f14cc002b43 0x7f14cc094a00
2023.01.24 20:15:07.396193 [ 419381 ] {} <Fatal> BaseDaemon: 2. ? @ 0x13942618 in /usr/bin/clickhouse
2023.01.24 20:15:07.396233 [ 419381 ] {} <Fatal> BaseDaemon: 3. ? @ 0x1394188f in /usr/bin/clickhouse
2023.01.24 20:15:07.396256 [ 419381 ] {} <Fatal> BaseDaemon: 4. ? @ 0x13908e88 in /usr/bin/clickhouse
2023.01.24 20:15:07.396298 [ 419381 ] {} <Fatal> BaseDaemon: 5. DB::Context::Context(DB::Context const&) @ 0x139079ba in /usr/bin/clickhouse
2023.01.24 20:15:07.396337 [ 419381 ] {} <Fatal> BaseDaemon: 6. ? @ 0x142e9b8a in /usr/bin/clickhouse
2023.01.24 20:15:07.396372 [ 419381 ] {} <Fatal> BaseDaemon: 7. DB::InterpreterSelectQuery::executeFetchColumns(DB::QueryProcessingStage::Enum, DB::QueryPlan&) @ 0x142fb9d4 in /usr/bin/clickhouse
2023.01.24 20:15:07.396423 [ 419381 ] {} <Fatal> BaseDaemon: 8. DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::optional<DB::Pipe>) @ 0x142efbaf in /usr/bin/clickhouse
2023.01.24 20:15:07.396449 [ 419381 ] {} <Fatal> BaseDaemon: 9. DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) @ 0x142eec6d in /usr/bin/clickhouse
2023.01.24 20:15:07.396479 [ 419381 ] {} <Fatal> BaseDaemon: 10. DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) @ 0x143896b4 in /usr/bin/clickhouse
2023.01.24 20:15:07.396505 [ 419381 ] {} <Fatal> BaseDaemon: 11. DB::InterpreterSelectQuery::executeFetchColumns(DB::QueryProcessingStage::Enum, DB::QueryPlan&) @ 0x142fbd64 in /usr/bin/clickhouse
2023.01.24 20:15:07.396545 [ 419381 ] {} <Fatal> BaseDaemon: 12. DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::optional<DB::Pipe>) @ 0x142efbaf in /usr/bin/clickhouse
2023.01.24 20:15:07.396573 [ 419381 ] {} <Fatal> BaseDaemon: 13. DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) @ 0x142eec6d in /usr/bin/clickhouse
2023.01.24 20:15:07.396601 [ 419381 ] {} <Fatal> BaseDaemon: 14. DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) @ 0x143892e5 in /usr/bin/clickhouse
2023.01.24 20:15:07.396627 [ 419381 ] {} <Fatal> BaseDaemon: 15. DB::InterpreterSelectWithUnionQuery::execute() @ 0x1438a2fe in /usr/bin/clickhouse
2023.01.24 20:15:07.396657 [ 419381 ] {} <Fatal> BaseDaemon: 16. ? @ 0x14692bb0 in /usr/bin/clickhouse
2023.01.24 20:15:07.396687 [ 419381 ] {} <Fatal> BaseDaemon: 17. DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) @ 0x1468fdad in /usr/bin/clickhouse
2023.01.24 20:15:07.396719 [ 419381 ] {} <Fatal> BaseDaemon: 18. DB::TCPHandler::runImpl() @ 0x1538858f in /usr/bin/clickhouse
2023.01.24 20:15:07.396742 [ 419381 ] {} <Fatal> BaseDaemon: 19. DB::TCPHandler::run() @ 0x1539be59 in /usr/bin/clickhouse
2023.01.24 20:15:07.396777 [ 419381 ] {} <Fatal> BaseDaemon: 20. Poco::Net::TCPServerConnection::start() @ 0x1821ac34 in /usr/bin/clickhouse
2023.01.24 20:15:07.396806 [ 419381 ] {} <Fatal> BaseDaemon: 21. Poco::Net::TCPServerDispatcher::run() @ 0x1821c5db in /usr/bin/clickhouse
2023.01.24 20:15:07.396837 [ 419381 ] {} <Fatal> BaseDaemon: 22. Poco::PooledThread::run() @ 0x183ab6c7 in /usr/bin/clickhouse
2023.01.24 20:15:07.396900 [ 419381 ] {} <Fatal> BaseDaemon: 23. Poco::ThreadImpl::runnableEntry(void*) @ 0x183a90fd in /usr/bin/clickhouse
2023.01.24 20:15:07.396925 [ 419381 ] {} <Fatal> BaseDaemon: 24. ? @ 0x7f14cc002b43 in ?
2023.01.24 20:15:07.396955 [ 419381 ] {} <Fatal> BaseDaemon: 25. ? @ 0x7f14cc094a00 in ?
2023.01.24 20:15:07.547764 [ 419381 ] {} <Fatal> BaseDaemon: Integrity check of the executable successfully passed (checksum: 707A227274554878C01CAF89F747CA21)

The query attached to the crash report is quite simple:

with tt as ( 
    Select cast(toStartOfInterval(timestamp, INTERVAL 1 day) as Date) as dd, count() as samples 
    from db.table_live_v2 
    group by dd having dd >= toDate(now())-100 
    ),
tt2 as ( 
    Select dd, samples from tt 
    union distinct 
    Select toDate(now())-1, ifnull((select samples from tt where dd = toDate(now())-1),0) as samples 
) 
Select dd, samples from tt2 order by dd WITH FILL STEP 1

Rerunning the query about 10 times in a row, I was able to crash Clickhouse again, with a different error

2023.01.24 22:18:19.532146 [ 425314 ] <Fatal> BaseDaemon: (version 22.12.3.5 (official build), build id: 1FC9EF37AB97BF195F9DF1C7D44CEC3DCC837FAD) (from thread 419389) (query_id: 8ecb919e-26ca-459d-9158-43e30146c529) (query: with tt as ( Select cast(toStartOfInterval(timestamp, INTERVAL 1 day) as Date) as dd, count() as samples from db.table_live_v2 group by dd having dd >= toDate(now())-100 ), tt2 as ( Select dd, samples from tt union distinct Select toDate(now())-1, ifnull((select samples from tt where dd = toDate(now())-1),0) as samples ) Select dd, samples from tt2 order by dd WITH FILL STEP 1) Received signal Segmentation fault (11)
2023.01.24 22:18:19.532173 [ 425314 ] <Fatal> BaseDaemon: Address: NULL pointer. Access: read. Address not mapped to object.
2023.01.24 22:18:19.532201 [ 425314 ] <Fatal> BaseDaemon: Stack trace: 0x142f6242 0x14302d18 0x142f1b6d 0x142eec6d 0x143892e5 0x1438a2fe 0x14692bb0 0x1468fdad 0x1538858f ac34 0x1821c5db 0x183ab6c7 0x183a90fd 0x7f06418fab43 0x7f064198ca00
2023.01.24 22:18:19.532256 [ 425314 ] <Fatal> BaseDaemon: 2. DB::InterpreterSelectQuery::getSortDescription(DB::ASTSelectQuery const&, std::__1::shared_ptr<DB::Context 0x142f6242 in /usr/bin/clickhouse
2023.01.24 22:18:19.532280 [ 425314 ] <Fatal> BaseDaemon: 3. DB::InterpreterSelectQuery::executeOrder(DB::QueryPlan&, std::__1::shared_ptr<DB::InputOrderInfo const>) @ r/bin/clickhouse
2023.01.24 22:18:19.532293 [ 425314 ] <Fatal> BaseDaemon: 4. DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::optional<DB::Pipe>) @ 0x142f1b6d in /usr/
2023.01.24 22:18:19.532312 [ 425314 ] <Fatal> BaseDaemon: 5. DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) @ 0x142eec6d in /usr/bin/clickhouse
2023.01.24 22:18:19.532330 [ 425314 ] <Fatal> BaseDaemon: 6. DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) @ 0x143892e5 in /usr/bin/clickhouse
2023.01.24 22:18:19.532361 [ 425314 ] <Fatal> BaseDaemon: 7. DB::InterpreterSelectWithUnionQuery::execute() @ 0x1438a2fe in /usr/bin/clickhouse
2023.01.24 22:18:19.532379 [ 425314 ] <Fatal> BaseDaemon: 8. ? @ 0x14692bb0 in /usr/bin/clickhouse
2023.01.24 22:18:19.532415 [ 425314 ] <Fatal> BaseDaemon: 9. DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> :shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) @ 0x1468fdad in /usr/bin/clickhouse
2023.01.24 22:18:19.532440 [ 425314 ] <Fatal> BaseDaemon: 10. DB::TCPHandler::runImpl() @ 0x1538858f in /usr/bin/clickhouse
2023.01.24 22:18:19.532457 [ 425314 ] <Fatal> BaseDaemon: 11. DB::TCPHandler::run() @ 0x1539be59 in /usr/bin/clickhouse
2023.01.24 22:18:19.532479 [ 425314 ] <Fatal> BaseDaemon: 12. Poco::Net::TCPServerConnection::start() @ 0x1821ac34 in /usr/bin/clickhouse
2023.01.24 22:18:19.532497 [ 425314 ] <Fatal> BaseDaemon: 13. Poco::Net::TCPServerDispatcher::run() @ 0x1821c5db in /usr/bin/clickhouse
2023.01.24 22:18:19.532524 [ 425314 ] <Fatal> BaseDaemon: 14. Poco::PooledThread::run() @ 0x183ab6c7 in /usr/bin/clickhouse
2023.01.24 22:18:19.532558 [ 425314 ] <Fatal> BaseDaemon: 15. Poco::ThreadImpl::runnableEntry(void*) @ 0x183a90fd in /usr/bin/clickhouse
2023.01.24 22:18:19.532577 [ 425314 ] <Fatal> BaseDaemon: 16. ? @ 0x7f06418fab43 in ?
2023.01.24 22:18:19.532593 [ 425314 ] <Fatal> BaseDaemon: 17. ? @ 0x7f064198ca00 in ?
2023.01.24 22:18:19.683348 [ 425314 ] <Fatal> BaseDaemon: Integrity check of the executable successfully passed (checksum: 707A227274554878C01CAF89F747CA21)

Thank you for all your help.

@mignaulo mignaulo added the potential bug To be reviewed by developers and confirmed/rejected. label Jan 24, 2023
@tavplubix tavplubix added the crash Crash / segfault / abort label Jan 25, 2023
@tavplubix
Copy link
Member

Please provide CREATE TABLE statement db.table_live_v2

@mignaulo
Copy link
Author

mignaulo commented Jan 25, 2023

@tavplubix oops sorry, here it is

CREATE TABLE statement:
https://pastila.nl/?00ecacd0/dd7604eca3dfee05f10b433298232f03

@alexey-milovidov
Copy link
Member

alexey-milovidov commented Jan 26, 2023

I'm trying to reproduce on master with the following:

SET allow_suspicious_low_cardinality_types = 1; 
CREATE TABLE table_live_v2
(
    `coverage` DateTime,
    `haunt` Nullable(Float32) CODEC(Gorilla, ZSTD(1)),
    `sail` Nullable(Float32) CODEC(Gorilla, ZSTD(1)),
    `empowerment_turnstile` LowCardinality(UInt8),
    `empowerment_haversack` LowCardinality(Nullable(Int16)),
    `empowerment_function` LowCardinality(Nullable(Int16)),
    `empowerment_guidance` Nullable(Int32),
    `empowerment_high` LowCardinality(Nullable(Int32)),
    `trading_id` Nullable(Int32),
    `guidance` Nullable(Int32),
    `empowerment_rawhide` LowCardinality(Int32),
    `memo` LowCardinality(Nullable(Int16)),
    `oeuvre` LowCardinality(Nullable(Int16)),
    `bun` LowCardinality(Nullable(Int16)),
    `tramp` LowCardinality(String),
    `anthropology_total` Nullable(Float32),
    `situation_name` LowCardinality(String),
    `timing` LowCardinality(Nullable(String)),
    `NAME_cockroach` LowCardinality(String),
    `NAME_toe` LowCardinality(String),
    `business_error_methane` FixedString(110),
    `business_instrumentation_methane` FixedString(15),
    `market` LowCardinality(UInt8),
    `crew_memo` LowCardinality(Nullable(Int16)),
    `crew_oeuvre` LowCardinality(Nullable(Int16)),
    `crew_fortnight` LowCardinality(Nullable(Int16)),
    `princess_memo` LowCardinality(Nullable(Int16)),
    `princess_oeuvre` LowCardinality(Nullable(Int16)),
    `princess_fortnight` LowCardinality(Nullable(Int16)),
    `emerald` Nullable(Float32),
    `cannon_crate` LowCardinality(Nullable(String)),
    `thinking` LowCardinality(String),
    `SectorMen` LowCardinality(String),
    `rage_name` LowCardinality(Nullable(String)),
    `DevelopmentalLigandName` LowCardinality(String),
    `chard_heavy_quadrant` UInt64,
    `poster_effective` LowCardinality(Nullable(String)),
    INDEX situation_name_cricketer situation_name TYPE bloom_filter GRANULARITY 4,
    INDEX NAME_cockroach_QUESTIONER NAME_cockroach TYPE bloom_filter GRANULARITY 4,
    INDEX NAME_toe_QUESTIONER NAME_toe TYPE bloom_filter GRANULARITY 4,
    INDEX poster_effective_QUESTIONER poster_effective TYPE bloom_filter GRANULARITY 4,
    INDEX chard_heavy_quadrant_QUESTIONER chard_heavy_quadrant TYPE bloom_filter GRANULARITY 4,
    INDEX empowerment_turnstile_cricketer empowerment_turnstile TYPE bloom_filter GRANULARITY 1,
    PROJECTION suit
    (
        SELECT
            toStartOfInterval(coverage, toIntervalMonth(1)),
            toStartOfWeek(coverage, 10),
            toStartOfInterval(coverage, toIntervalDay(1)),
            empowerment_turnstile,
            NAME_toe,
            NAME_cockroach,
            situation_name,
            DevelopmentalLigandName,
            rage_name,
            empowerment_rawhide,
            timing,
            empowerment_high,
            empowerment_guidance
        GROUP BY
            toStartOfInterval(coverage, toIntervalMonth(1)),
            toStartOfWeek(coverage, 10),
            toStartOfInterval(coverage, toIntervalDay(1)),
            empowerment_turnstile,
            NAME_toe,
            NAME_cockroach,
            situation_name,
            DevelopmentalLigandName,
            rage_name,
            empowerment_rawhide,
            timing,
            empowerment_high,
            empowerment_guidance
    ),
    PROJECTION southeast_trapezium
    (
        SELECT
            NAME_toe,
            NAME_cockroach,
            toStartOfMonth(coverage) AS coverage_behold,
            timing,
            situation_name,
            rage_name,
            NULL AS buggy,
            cannon_crate,
            count(memo) AS memo_regulation,
            count(oeuvre) AS oeuvre_regulation,
            count(bun) AS bun_regulation,
            avg(memo) AS memo_quote,
            avg(oeuvre) AS oeuvre_quote,
            avg(bun) AS bun_quote,
            h3ToParent(chard_heavy_quadrant, 5) AS chard_id_quadrant_spaghetti,
            h3ToParent(chard_heavy_quadrant, 10) AS chard_id_quadrant_gathering,
            h3ToParent(chard_heavy_quadrant, 10) AS chard_id_quadrant_spear,
            h3ToParent(chard_heavy_quadrant, 10) AS chard_id_quadrant_heavy,
            arrayPushBack(h3ToGeoBoundary(chard_id_quadrant_spaghetti), h3ToGeoBoundary(chard_id_quadrant_spaghetti)[1]) AS riseCooking_spaghetti,
            arrayPushBack(h3ToGeoBoundary(chard_id_quadrant_gathering), h3ToGeoBoundary(chard_id_quadrant_gathering)[1]) AS riseCooking_gathering,
            arrayPushBack(h3ToGeoBoundary(chard_id_quadrant_spear), h3ToGeoBoundary(chard_id_quadrant_spear)[1]) AS riseCooking_spear,
            arrayPushBack(h3ToGeoBoundary(chard_id_quadrant_heavy), h3ToGeoBoundary(chard_id_quadrant_heavy)[1]) AS riseCooking_heavy
        GROUP BY
            NAME_toe,
            NAME_cockroach,
            coverage_behold,
            situation_name,
            timing,
            rage_name,
            buggy,
            cannon_crate,
            chard_id_quadrant_spaghetti,
            chard_id_quadrant_gathering,
            chard_id_quadrant_spear,
            chard_id_quadrant_heavy
    ),
    PROJECTION chrysalis_trapezium_ham
    (
        SELECT
            empowerment_turnstile,
            toStartOfInterval(coverage, toIntervalMonth(1)),
            toStartOfWeek(coverage, 10),
            toStartOfInterval(coverage, toIntervalDay(1)),
            NAME_toe,
            NAME_cockroach,
            situation_name,
            memo,
            oeuvre,
            crew_memo,
            crew_oeuvre,
            bun,
            sum(multiIf(crew_memo IS NULL, 0, 1)),
            sum(multiIf(crew_oeuvre IS NULL, 0, 1)),
            sum(multiIf(crew_fortnight IS NULL, 0, 1)),
            max(toStartOfInterval(coverage, toIntervalDay(1))),
            max(CAST(CAST(toStartOfInterval(coverage, toIntervalDay(1)), 'Nullable(DATE)'), 'Nullable(TIMESTAMP)')),
            min(toStartOfInterval(coverage, toIntervalDay(1))),
            min(CAST(CAST(toStartOfInterval(coverage, toIntervalDay(1)), 'Nullable(DATE)'), 'Nullable(TIMESTAMP)')),
            count(),
            sum(1),
            COUNTDistinct(NAME_cockroach),
            COUNTDistinct(rage_name),
            COUNTDistinct(situation_name),
            COUNTDistinct(CAST(toStartOfInterval(coverage, toIntervalDay(1)), 'Nullable(DATE)'))
        GROUP BY
            empowerment_turnstile,
            toStartOfInterval(coverage, toIntervalMonth(1)),
            toStartOfWeek(coverage, 10),
            toStartOfInterval(coverage, toIntervalDay(1)),
            empowerment_turnstile,
            toStartOfInterval(coverage, toIntervalMonth(1)),
            toStartOfWeek(coverage, 10),
            toStartOfInterval(coverage, toIntervalDay(1)),
            NAME_toe,
            NAME_cockroach,
            situation_name,
            memo,
            oeuvre,
            crew_memo,
            crew_oeuvre,
            bun
    ),
    PROJECTION joy_trapezium
    (
        SELECT
            toStartOfInterval(coverage, toIntervalMonth(1)),
            toStartOfWeek(coverage, 10),
            toStartOfInterval(coverage, toIntervalDay(1)),
            timing,
            empowerment_turnstile,
            NAME_toe,
            NAME_cockroach,
            situation_name,
            DevelopmentalLigandName,
            rage_name,
            count(),
            COUNTDistinct(empowerment_high),
            COUNTDistinct(empowerment_turnstile),
            COUNTDistinct(empowerment_guidance),
            COUNTDistinct(empowerment_rawhide),
            COUNTDistinct(timing),
            quantileTDigest(0)(NULL),
            avg(memo),
            quantileTDigest(0.7)(memo),
            quantileTDigest(0.1)(memo),
            quantileTDigest(0.10)(memo),
            avg(oeuvre),
            quantileTDigest(0.7)(oeuvre),
            quantileTDigest(0.1)(oeuvre),
            quantileTDigest(0.10)(oeuvre),
            avg(crew_memo),
            quantileTDigest(0.7)(crew_memo),
            quantileTDigest(0.1)(crew_memo),
            quantileTDigest(0.10)(crew_memo),
            avg(crew_oeuvre),
            quantileTDigest(0.7)(crew_oeuvre),
            quantileTDigest(0.1)(crew_oeuvre),
            quantileTDigest(0.10)(crew_oeuvre),
            avg(crew_oeuvre),
            quantileTDigest(0.7)(crew_oeuvre),
            quantileTDigest(0.1)(crew_oeuvre),
            quantileTDigest(0.10)(crew_oeuvre),
            avg(crew_fortnight),
            quantileTDigest(0.7)(crew_fortnight),
            quantileTDigest(0.1)(crew_fortnight),
            quantileTDigest(0.10)(crew_fortnight),
            avg(bun),
            quantileTDigest(0.7)(bun),
            quantileTDigest(0.1)(bun),
            quantileTDigest(0.10)(bun),
            count(memo),
            count(oeuvre),
            count(bun),
            count(crew_memo),
            count(crew_oeuvre),
            count(crew_fortnight),
            max(toStartOfInterval(coverage, toIntervalDay(1))),
            min(toStartOfInterval(coverage, toIntervalDay(1)))
        GROUP BY
            toStartOfInterval(coverage, toIntervalMonth(1)),
            toStartOfWeek(coverage, 10),
            toStartOfInterval(coverage, toIntervalDay(1)),
            timing,
            empowerment_turnstile,
            NAME_toe,
            NAME_cockroach,
            situation_name,
            DevelopmentalLigandName,
            rage_name
    )
)
ENGINE = MergeTree
PARTITION BY toYYYYMM(coverage)
ORDER BY (coverage, situation_name, NAME_toe, NAME_cockroach)


clickhouse-benchmark --query "with dissonance as ( 
    Select cast(toStartOfInterval(coverage, INTERVAL 1 day) as Date) as flour, count() as regulation 
    from table_live_v2
    group by flour having flour >= toDate(now())-100 
    ),
cheetah as ( 
    Select flour, regulation from dissonance 
    union distinct 
    Select toDate(now())-1, ifnull((select regulation from dissonance where flour = toDate(now())-1),0) as regulation 
) 
Select flour, regulation from cheetah order by flour with fill step 1"

It does not reproduce in one minute...

@alexey-milovidov
Copy link
Member

I've reproduced it successfully after inserting data.

@alexey-milovidov alexey-milovidov added bug Confirmed user-visible misbehaviour in official release and removed potential bug To be reviewed by developers and confirmed/rejected. labels Jan 26, 2023
@alexey-milovidov
Copy link
Member

Thread 519 "QueryPipelineEx" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffe7a156640 (LWP 501852)]
0x000000000d781a0e in DB::ColumnDescription::~ColumnDescription() ()
(gdb) bt
#0  0x000000000d781a0e in DB::ColumnDescription::~ColumnDescription() ()
#1  0x00000000164610dd in DB::IMergeTreeReader::~IMergeTreeReader() ()
#2  0x000000001646103a in DB::MergeTreeReaderCompact::~MergeTreeReaderCompact() ()
#3  0x0000000016ca82e3 in DB::IMergeTreeSelectAlgorithm::initializeMergeTreeReadersForPart(std::__1::shared_ptr<DB::IMergeTreeDataPart const>&, DB::MergeTreeReadTaskColumns const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::deque<DB::MarkRange, std::__1::allocator<DB::MarkRange> > const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, double> > > const&, std::__1::function<void (DB::ReadBufferFromFileBase::ProfileInfo)> const&) ()
#4  0x0000000016cc3078 in DB::MergeTreeThreadSelectAlgorithm::finalizeNewTask() ()
#5  0x0000000016ca79fe in DB::IMergeTreeSelectAlgorithm::read() ()
#6  0x0000000016cc0fa3 in DB::MergeTreeSource::tryGenerate() ()
#7  0x00000000169588a4 in DB::ISource::work() ()
#8  0x00000000169700a2 in DB::ExecutionThreadContext::executeTask() ()
#9  0x000000001696675a in DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic<bool>*) ()
#10 0x0000000016967c51 in void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<DB::PipelineExecutor::spawnThreads()::$_0>(DB::PipelineExecutor::spawnThreads()::$_0&&)::{lambda()#1}, void ()> >(std::__1::__function::__policy_storage const*) ()
#11 0x0000000010232160 in ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) ()
#12 0x00000000102355ce in 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> >, ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::{lambda()#2}> >(void*) ()
#13 0x00007ffff7e00b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#14 0x00007ffff7e92a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

@alexey-milovidov
Copy link
Member

alexey-milovidov commented Jan 26, 2023

Reproduced by:

  1. Merging this PR: Allow LowCardinality in GenerateRandom #45661
  2. Running the query INSERT INTO table_live_v2 SELECT * FROM generateRandom() LIMIT 100 around 10 times.
  3. Running
clickhouse-benchmark -c4 --query "with dissonance as ( 
    Select cast(toStartOfInterval(coverage, INTERVAL 1 day) as Date) as flour, count() as regulation 
    from table_live_v2
    group by flour having flour >= toDate(now())-100 
    ),
cheetah as ( 
    Select flour, regulation from dissonance 
    union distinct 
    Select toDate(now())-1, ifnull((select regulation from dissonance where flour = toDate(now())-1),0) as regulation 
) 
Select flour, regulation from cheetah order by flour with fill step 1"

@alexey-milovidov
Copy link
Member

alexey-milovidov commented Jan 26, 2023

It takes up to several hundred to several thousand iterations to reproduce.

@alexey-milovidov
Copy link
Member

alexey-milovidov commented Jan 26, 2023

Reproduced immediately under ASan.

@alexey-milovidov
Copy link
Member

==606046==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x610000de6730 at pc 0x00003461c8e4 bp 0x7fa1005d40f0 sp 0x7fa1005d40e8
WRITE of size 8 at 0x610000de6730 thread T4 (TCPHandler)
    #0 0x3461c8e3 in DB::KeyCondition::getDescription() const build_asan/./src/Storages/MergeTree/KeyCondition.cpp:1855:31
    #1 0x3492d8e4 in DB::MergeTreeDataSelectExecutor::filterPartsByPrimaryKeyAndSkipIndexes(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>&&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const>, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const> const&, DB::KeyCondition const&, DB::MergeTreeReaderSettings const&, Poco::Logger*, unsigned long, std::__1::vector<DB::ReadFromMergeTree::IndexStat, std::__1::allocator<DB::ReadFromMergeTree::IndexStat>>&, bool) build_asan/./src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp:1140:42
    #2 0x360aedac in DB::ReadFromMergeTree::selectRangesToReadImpl(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>, DB::MergeTreeData const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, bool, Poco::Logger*) build_asan/./src/Processors/QueryPlan/ReadFromMergeTree.cpp:1111:36
    #3 0x360aab9f in DB::ReadFromMergeTree::selectRangesToRead(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>, std::__1::shared_ptr<DB::PrewhereInfo> const&, DB::ActionDAGNodes const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>, DB::MergeTreeData const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, bool, Poco::Logger*) build_asan/./src/Processors/QueryPlan/ReadFromMergeTree.cpp:967:16
    #4 0x349371a6 in DB::MergeTreeDataSelectExecutor::estimateNumMarksToRead(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>, std::__1::shared_ptr<DB::PrewhereInfo> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, DB::ActionDAGNodes const&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>) const build_asan/./src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp:1323:12
    #5 0x347c1c1e in DB::selectBestProjection(DB::MergeTreeDataSelectExecutor const&, std::__1::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo const&, DB::ActionDAGNodes const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, DB::ProjectionCandidate&, std::__1::shared_ptr<DB::Context const>, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>, DB::Settings const&, std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>> const&, DB::ProjectionCandidate*&, unsigned long&) build_asan/./src/Storages/MergeTree/MergeTreeData.cpp:6030:41
    #6 0x347bab87 in DB::MergeTreeData::getQueryProcessingStageWithAggregateProjection(std::__1::shared_ptr<DB::Context const>, std::__1::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo&) const build_asan/./src/Storages/MergeTree/MergeTreeData.cpp:6746:17
    #7 0x347c2ac8 in DB::MergeTreeData::getQueryProcessingStage(std::__1::shared_ptr<DB::Context const>, DB::QueryProcessingStage::Enum, std::__1::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo&) const build_asan/./src/Storages/MergeTree/MergeTreeData.cpp:6813:31
    #8 0x32240d96 in DB::InterpreterSelectQuery::getSampleBlockImpl() build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:831:31
    #9 0x3222fd9e in DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>)::$_2::operator()(bool) const build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:684:25
    #10 0x32222efd in DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:687:5
    #11 0x3221d944 in DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:200:7
    #12 0x3238ecf5 in std::__1::__unique_if<DB::InterpreterSelectQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectQuery, std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&>(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32
    #13 0x3238ecf5 in DB::InterpreterSelectWithUnionQuery::buildCurrentChildInterpreter(std::__1::shared_ptr<DB::IAST> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:250:16
    #14 0x3238a82f in DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:148:13
    #15 0x323896b8 in DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:40:7
    #16 0x3224a48b in std::__1::__unique_if<DB::InterpreterSelectWithUnionQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectWithUnionQuery, std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&>(std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>&&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&) build_asan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32
    #17 0x3224a48b in DB::InterpreterSelectQuery::executeFetchColumns(DB::QueryProcessingStage::Enum, DB::QueryPlan&) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:2267:32
    #18 0x322395c9 in DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::optional<DB::Pipe>) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:1344:9
    #19 0x32238365 in DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:770:5
    #20 0x32393395 in DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:308:38
    #21 0x323949e1 in DB::InterpreterSelectWithUnionQuery::execute() build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:382:5
    #22 0x32b3d43e in DB::ExecuteScalarSubqueriesMatcher::visit(DB::ASTSubquery const&, std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_asan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:187:36
    #23 0x32b3c5af in DB::ExecuteScalarSubqueriesMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_asan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:66:9
    #24 0x32a4fc16 in DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::doVisit(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:71:13
    #25 0x32a4ff28 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:61:9
    #26 0x32a4ff28 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:51:13
    #27 0x32a4ff28 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitChildren<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:92:17
    #28 0x32b45c67 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:64:13
    #29 0x32b45c67 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:51:13
    #30 0x32b45c67 in DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visit(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:32:13
    #31 0x32b45c67 in DB::ExecuteScalarSubqueriesMatcher::visit(DB::ASTFunction const&, std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_asan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:317:23
    #32 0x32a4fc16 in DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::doVisit(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:71:13
    #33 0x32a4ff28 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:61:9
    #34 0x32a4ff28 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:51:13
    #35 0x32a4ff28 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitChildren<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:92:17
    #36 0x32a4ff33 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:64:13
    #37 0x32a4ff33 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:51:13
    #38 0x32a4ff33 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitChildren<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:92:17
    #39 0x32a35dc1 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:64:13
    #40 0x32a35dc1 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:51:13
    #41 0x32a35dc1 in DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visit(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:32:13
    #42 0x32a35dc1 in DB::(anonymous namespace)::executeScalarSubqueries(std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, DB::Block, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, DB::Block>>>&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, DB::Block, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, DB::Block>>>&, bool) build_asan/./src/Interpreters/TreeRewriter.cpp:490:64
    #43 0x32a2a3e7 in DB::TreeRewriter::analyzeSelect(std::__1::shared_ptr<DB::IAST>&, DB::TreeRewriterResult&&, DB::SelectQueryOptions const&, std::__1::vector<DB::TableWithColumnNamesAndTypes, std::__1::allocator<DB::TableWithColumnNamesAndTypes>> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::TableJoin>, bool, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>>, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>>) const build_asan/./src/Interpreters/TreeRewriter.cpp:1258:5
    #44 0x3222bea5 in DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>)::$_2::operator()(bool) const build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:535:56
    #45 0x32222efd in DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:687:5
    #46 0x3221d944 in DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:200:7
    #47 0x3238ecf5 in std::__1::__unique_if<DB::InterpreterSelectQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectQuery, std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&>(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32
    #48 0x3238ecf5 in DB::InterpreterSelectWithUnionQuery::buildCurrentChildInterpreter(std::__1::shared_ptr<DB::IAST> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:250:16
    #49 0x3238a82f in DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:148:13
    #50 0x323896b8 in DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:40:7
    #51 0x3224a48b in std::__1::__unique_if<DB::InterpreterSelectWithUnionQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectWithUnionQuery, std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&>(std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>&&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&) build_asan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32
    #52 0x3224a48b in DB::InterpreterSelectQuery::executeFetchColumns(DB::QueryProcessingStage::Enum, DB::QueryPlan&) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:2267:32
    #53 0x322395c9 in DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::optional<DB::Pipe>) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:1344:9
    #54 0x32238365 in DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:770:5
    #55 0x32393395 in DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:308:38
    #56 0x323949e1 in DB::InterpreterSelectWithUnionQuery::execute() build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:382:5
    #57 0x32c198b7 in DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) build_asan/./src/Interpreters/executeQuery.cpp:715:36
    #58 0x32c1254b in DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) build_asan/./src/Interpreters/executeQuery.cpp:1169:30
    #59 0x354f3e1d in DB::TCPHandler::runImpl() build_asan/./src/Server/TCPHandler.cpp:378:24
    #60 0x35524ab3 in DB::TCPHandler::run() build_asan/./src/Server/TCPHandler.cpp:1945:9
    #61 0x3cd9e4ae in Poco::Net::TCPServerConnection::start() build_asan/./contrib/poco/Net/src/TCPServerConnection.cpp:43:3
    #62 0x3cd9f204 in Poco::Net::TCPServerDispatcher::run() build_asan/./contrib/poco/Net/src/TCPServerDispatcher.cpp:115:20
    #63 0x3d26b45b in Poco::PooledThread::run() build_asan/./contrib/poco/Foundation/src/ThreadPool.cpp:199:14
    #64 0x3d264a4c in Poco::ThreadImpl::runnableEntry(void*) build_asan/./contrib/poco/Foundation/src/Thread_POSIX.cpp:345:27
    #65 0x7fa237f7ab42 in start_thread nptl/pthread_create.c:442:8
    #66 0x7fa23800c9ff  misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

0x610000de6730 is located 48 bytes to the right of 192-byte region [0x610000de6640,0x610000de6700)
allocated by thread T4 (TCPHandler) here:
    #0 0xe85c56d in operator new(unsigned long) /home/milovidov/work/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:95:3
    #1 0x34639e04 in void* std::__1::__libcpp_operator_new[abi:v15000]<unsigned long>(unsigned long) build_asan/./contrib/llvm-project/libcxx/include/new:246:10
    #2 0x34639e04 in std::__1::__libcpp_allocate[abi:v15000](unsigned long, unsigned long) build_asan/./contrib/llvm-project/libcxx/include/new:272:10
    #3 0x34639e04 in std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char>>>::allocate[abi:v15000](unsigned long) build_asan/./contrib/llvm-project/libcxx/include/__memory/allocator.h:112:38
    #4 0x34639e04 in std::__1::__allocation_result<std::__1::allocator_traits<std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char>>>>::pointer> std::__1::__allocate_at_least[abi:v15000]<std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char>>>>(std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char>>>&, unsigned long) build_asan/./contrib/llvm-project/libcxx/include/__memory/allocate_at_least.h:54:19
    #5 0x34639e04 in std::__1::vector<std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char>>>>::__vallocate[abi:v15000](unsigned long) build_asan/./contrib/llvm-project/libcxx/include/vector:682:29
    #6 0x34639e04 in std::__1::vector<std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char>>>>::vector(unsigned long) build_asan/./contrib/llvm-project/libcxx/include/vector:1081:9
    #7 0x3461beaf in DB::KeyCondition::getDescription() const build_asan/./src/Storages/MergeTree/KeyCondition.cpp:1851:35
    #8 0x3492d8e4 in DB::MergeTreeDataSelectExecutor::filterPartsByPrimaryKeyAndSkipIndexes(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>&&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const>, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const> const&, DB::KeyCondition const&, DB::MergeTreeReaderSettings const&, Poco::Logger*, unsigned long, std::__1::vector<DB::ReadFromMergeTree::IndexStat, std::__1::allocator<DB::ReadFromMergeTree::IndexStat>>&, bool) build_asan/./src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp:1140:42
    #9 0x360aedac in DB::ReadFromMergeTree::selectRangesToReadImpl(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>, DB::MergeTreeData const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, bool, Poco::Logger*) build_asan/./src/Processors/QueryPlan/ReadFromMergeTree.cpp:1111:36
    #10 0x360aab9f in DB::ReadFromMergeTree::selectRangesToRead(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>, std::__1::shared_ptr<DB::PrewhereInfo> const&, DB::ActionDAGNodes const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>, DB::MergeTreeData const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, bool, Poco::Logger*) build_asan/./src/Processors/QueryPlan/ReadFromMergeTree.cpp:967:16
    #11 0x349371a6 in DB::MergeTreeDataSelectExecutor::estimateNumMarksToRead(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>, std::__1::shared_ptr<DB::PrewhereInfo> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, DB::ActionDAGNodes const&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>) const build_asan/./src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp:1323:12
    #12 0x347c1c1e in DB::selectBestProjection(DB::MergeTreeDataSelectExecutor const&, std::__1::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo const&, DB::ActionDAGNodes const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, DB::ProjectionCandidate&, std::__1::shared_ptr<DB::Context const>, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>, DB::Settings const&, std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>> const&, DB::ProjectionCandidate*&, unsigned long&) build_asan/./src/Storages/MergeTree/MergeTreeData.cpp:6030:41
    #13 0x347bab87 in DB::MergeTreeData::getQueryProcessingStageWithAggregateProjection(std::__1::shared_ptr<DB::Context const>, std::__1::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo&) const build_asan/./src/Storages/MergeTree/MergeTreeData.cpp:6746:17
    #14 0x347c2ac8 in DB::MergeTreeData::getQueryProcessingStage(std::__1::shared_ptr<DB::Context const>, DB::QueryProcessingStage::Enum, std::__1::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo&) const build_asan/./src/Storages/MergeTree/MergeTreeData.cpp:6813:31
    #15 0x32240d96 in DB::InterpreterSelectQuery::getSampleBlockImpl() build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:831:31
    #16 0x3222fd9e in DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>)::$_2::operator()(bool) const build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:684:25
    #17 0x32222efd in DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:687:5
    #18 0x3221d944 in DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:200:7
    #19 0x3238ecf5 in std::__1::__unique_if<DB::InterpreterSelectQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectQuery, std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&>(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32
    #20 0x3238ecf5 in DB::InterpreterSelectWithUnionQuery::buildCurrentChildInterpreter(std::__1::shared_ptr<DB::IAST> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:250:16
    #21 0x3238a82f in DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:148:13
    #22 0x323896b8 in DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:40:7
    #23 0x3224a48b in std::__1::__unique_if<DB::InterpreterSelectWithUnionQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectWithUnionQuery, std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&>(std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>&&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&) build_asan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32
    #24 0x3224a48b in DB::InterpreterSelectQuery::executeFetchColumns(DB::QueryProcessingStage::Enum, DB::QueryPlan&) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:2267:32
    #25 0x322395c9 in DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::optional<DB::Pipe>) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:1344:9
    #26 0x32238365 in DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) build_asan/./src/Interpreters/InterpreterSelectQuery.cpp:770:5
    #27 0x32393395 in DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:308:38
    #28 0x323949e1 in DB::InterpreterSelectWithUnionQuery::execute() build_asan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:382:5
    #29 0x32b3d43e in DB::ExecuteScalarSubqueriesMatcher::visit(DB::ASTSubquery const&, std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_asan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:187:36
    #30 0x32b3c5af in DB::ExecuteScalarSubqueriesMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_asan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:66:9
    #31 0x32a4fc16 in DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::doVisit(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:71:13
    #32 0x32a4ff28 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:61:9
    #33 0x32a4ff28 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:51:13
    #34 0x32a4ff28 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitChildren<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:92:17
    #35 0x32b45c67 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:64:13
    #36 0x32b45c67 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:51:13
    #37 0x32b45c67 in DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visit(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:32:13
    #38 0x32b45c67 in DB::ExecuteScalarSubqueriesMatcher::visit(DB::ASTFunction const&, std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_asan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:317:23
    #39 0x32a4fc16 in DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::doVisit(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:71:13
    #40 0x32a4ff28 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:61:9
    #41 0x32a4ff28 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:51:13
    #42 0x32a4ff28 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitChildren<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:92:17
    #43 0x32a4ff33 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:64:13
    #44 0x32a4ff33 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:51:13
    #45 0x32a4ff33 in void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitChildren<false>(std::__1::shared_ptr<DB::IAST>&) build_asan/./src/Interpreters/InDepthNodeVisitor.h:92:17

Thread T4 (TCPHandler) created by T0 here:
    #0 0xe80959c in pthread_create /home/milovidov/work/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:208:3
    #1 0x3d263e45 in Poco::ThreadImpl::startImpl(Poco::SharedPtr<Poco::Runnable, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::Runnable>>) build_asan/./contrib/poco/Foundation/src/Thread_POSIX.cpp:202:6
    #2 0x3d266dfd in Poco::Thread::start(Poco::Runnable&) build_asan/./contrib/poco/Foundation/src/Thread.cpp:128:2
    #3 0x3d26bde9 in Poco::PooledThread::start() build_asan/./contrib/poco/Foundation/src/ThreadPool.cpp:85:10
    #4 0x3d26bde9 in Poco::ThreadPool::ThreadPool(int, int, int, int) build_asan/./contrib/poco/Foundation/src/ThreadPool.cpp:252:12
    #5 0x1fd04c38 in DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_asan/./programs/server/Server.cpp:774:22
    #6 0x3cdd509e in Poco::Util::Application::run() build_asan/./contrib/poco/Util/src/Application.cpp:334:8
    #7 0x1fcf9afa in DB::Server::run() build_asan/./programs/server/Server.cpp:474:25
    #8 0x3ce18f7f in Poco::Util::ServerApplication::run(int, char**) build_asan/./contrib/poco/Util/src/ServerApplication.cpp:611:9
    #9 0x1fcf1e61 in mainEntryClickHouseServer(int, char**) build_asan/./programs/server/Server.cpp:195:20
    #10 0xe8609ad in main build_asan/./programs/main.cpp:482:12
    #11 0x7fa237f0fd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

SUMMARY: AddressSanitizer: heap-buffer-overflow build_asan/./src/Storages/MergeTree/KeyCondition.cpp:1855:31 in DB::KeyCondition::getDescription() const
Shadow bytes around the buggy address:
  0x0c20801b4c90: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa
  0x0c20801b4ca0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c20801b4cb0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c20801b4cc0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c20801b4cd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c20801b4ce0: fa fa fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa
  0x0c20801b4cf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c20801b4d00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c20801b4d10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c20801b4d20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c20801b4d30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==606046==ABORTING

@alexey-milovidov
Copy link
Member

==================
WARNING: ThreadSanitizer: heap-use-after-free (pid=607000)
  Write of size 8 at 0x7b30009136b0 by thread T3:
    #0 DB::KeyCondition::getDescription() const build_tsan/./src/Storages/MergeTree/KeyCondition.cpp:1855:31 (clickhouse+0x1e0b886b) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #1 DB::MergeTreeDataSelectExecutor::filterPartsByPrimaryKeyAndSkipIndexes(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>&&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const>, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const> const&, DB::KeyCondition const&, DB::MergeTreeReaderSettings const&, Poco::Logger*, unsigned long, std::__1::vector<DB::ReadFromMergeTree::IndexStat, std::__1::allocator<DB::ReadFromMergeTree::IndexStat>>&, bool) build_tsan/./src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp:1140:42 (clickhouse+0x1e2214d8) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #2 DB::ReadFromMergeTree::selectRangesToReadImpl(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>, DB::MergeTreeData const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, bool, Poco::Logger*) build_tsan/./src/Processors/QueryPlan/ReadFromMergeTree.cpp:1111:36 (clickhouse+0x1ee43799) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #3 DB::ReadFromMergeTree::selectRangesToRead(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>, std::__1::shared_ptr<DB::PrewhereInfo> const&, DB::ActionDAGNodes const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>, DB::MergeTreeData const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, bool, Poco::Logger*) build_tsan/./src/Processors/QueryPlan/ReadFromMergeTree.cpp:967:16 (clickhouse+0x1ee417fb) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #4 DB::MergeTreeDataSelectExecutor::estimateNumMarksToRead(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>, std::__1::shared_ptr<DB::PrewhereInfo> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, DB::ActionDAGNodes const&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>) const build_tsan/./src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp:1323:12 (clickhouse+0x1e225387) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #5 DB::selectBestProjection(DB::MergeTreeDataSelectExecutor const&, std::__1::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo const&, DB::ActionDAGNodes const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, DB::ProjectionCandidate&, std::__1::shared_ptr<DB::Context const>, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>, DB::Settings const&, std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>> const&, DB::ProjectionCandidate*&, unsigned long&) build_tsan/./src/Storages/MergeTree/MergeTreeData.cpp:6030:41 (clickhouse+0x1e176e8c) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #6 DB::MergeTreeData::getQueryProcessingStageWithAggregateProjection(std::__1::shared_ptr<DB::Context const>, std::__1::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo&) const build_tsan/./src/Storages/MergeTree/MergeTreeData.cpp:6746:17 (clickhouse+0x1e172ef5) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #7 DB::MergeTreeData::getQueryProcessingStage(std::__1::shared_ptr<DB::Context const>, DB::QueryProcessingStage::Enum, std::__1::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo&) const build_tsan/./src/Storages/MergeTree/MergeTreeData.cpp:6813:31 (clickhouse+0x1e177836) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #8 DB::InterpreterSelectQuery::getSampleBlockImpl() build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:831:31 (clickhouse+0x1cf914a0) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #9 DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>)::$_2::operator()(bool) const build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:684:25 (clickhouse+0x1cf88de7) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #10 DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:687:5 (clickhouse+0x1cf82dce) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #11 DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:200:7 (clickhouse+0x1cf7f8e5) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #12 std::__1::__unique_if<DB::InterpreterSelectQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectQuery, std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&>(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32 (clickhouse+0x1d03147e) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #13 DB::InterpreterSelectWithUnionQuery::buildCurrentChildInterpreter(std::__1::shared_ptr<DB::IAST> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:250:16 (clickhouse+0x1d03147e)
    #14 DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:148:13 (clickhouse+0x1d02ea98) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #15 DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:40:7 (clickhouse+0x1d02dae2) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #16 std::__1::__unique_if<DB::InterpreterSelectWithUnionQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectWithUnionQuery, std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&>(std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>&&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&) build_tsan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32 (clickhouse+0x1cf96acc) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #17 DB::InterpreterSelectQuery::executeFetchColumns(DB::QueryProcessingStage::Enum, DB::QueryPlan&) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:2267:32 (clickhouse+0x1cf96acc)
    #18 DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::optional<DB::Pipe>) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:1344:9 (clickhouse+0x1cf8dad5) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #19 DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:770:5 (clickhouse+0x1cf8ce25) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #20 DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:308:38 (clickhouse+0x1d034484) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #21 DB::InterpreterSelectWithUnionQuery::execute() build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:382:5 (clickhouse+0x1d035358) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #22 DB::ExecuteScalarSubqueriesMatcher::visit(DB::ASTSubquery const&, std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_tsan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:187:36 (clickhouse+0x1d3c9d8d) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #23 DB::ExecuteScalarSubqueriesMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_tsan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:66:9 (clickhouse+0x1d3c9383) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #24 DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::doVisit(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:71:13 (clickhouse+0x1d357b6e) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #25 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:61:9 (clickhouse+0x1d357cd8) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #26 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:51:13 (clickhouse+0x1d357cd8)
    #27 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitChildren<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:92:17 (clickhouse+0x1d357cd8)
    #28 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:64:13 (clickhouse+0x1d3ce1ca) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #29 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:51:13 (clickhouse+0x1d3ce1ca)
    #30 DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visit(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:32:13 (clickhouse+0x1d3ce1ca)
    #31 DB::ExecuteScalarSubqueriesMatcher::visit(DB::ASTFunction const&, std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_tsan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:317:23 (clickhouse+0x1d3ce1ca)
    #32 DB::ExecuteScalarSubqueriesMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_tsan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:68:9 (clickhouse+0x1d3c93db) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #33 DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::doVisit(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:71:13 (clickhouse+0x1d357b6e) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #34 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:61:9 (clickhouse+0x1d357cd8) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #35 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:51:13 (clickhouse+0x1d357cd8)
    #36 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitChildren<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:92:17 (clickhouse+0x1d357cd8)
    #37 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:64:13 (clickhouse+0x1d357ce3) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #38 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:51:13 (clickhouse+0x1d357ce3)
    #39 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitChildren<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:92:17 (clickhouse+0x1d357ce3)
    #40 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:64:13 (clickhouse+0x1d34c005) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #41 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:51:13 (clickhouse+0x1d34c005)
    #42 DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visit(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:32:13 (clickhouse+0x1d34c005)
    #43 DB::(anonymous namespace)::executeScalarSubqueries(std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, DB::Block, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, DB::Block>>>&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, DB::Block, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, DB::Block>>>&, bool) build_tsan/./src/Interpreters/TreeRewriter.cpp:490:64 (clickhouse+0x1d34c005)
    #44 DB::TreeRewriter::analyzeSelect(std::__1::shared_ptr<DB::IAST>&, DB::TreeRewriterResult&&, DB::SelectQueryOptions const&, std::__1::vector<DB::TableWithColumnNamesAndTypes, std::__1::allocator<DB::TableWithColumnNamesAndTypes>> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::TableJoin>, bool, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>>, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>>) const build_tsan/./src/Interpreters/TreeRewriter.cpp:1258:5 (clickhouse+0x1d347515) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #45 DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>)::$_2::operator()(bool) const build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:535:56 (clickhouse+0x1cf86723) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #46 DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:687:5 (clickhouse+0x1cf82dce) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #47 DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:200:7 (clickhouse+0x1cf7f8e5) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #48 std::__1::__unique_if<DB::InterpreterSelectQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectQuery, std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&>(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32 (clickhouse+0x1d03147e) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #49 DB::InterpreterSelectWithUnionQuery::buildCurrentChildInterpreter(std::__1::shared_ptr<DB::IAST> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:250:16 (clickhouse+0x1d03147e)
    #50 DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:148:13 (clickhouse+0x1d02ea98) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #51 DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:40:7 (clickhouse+0x1d02dae2) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #52 std::__1::__unique_if<DB::InterpreterSelectWithUnionQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectWithUnionQuery, std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&>(std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>&&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&) build_tsan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32 (clickhouse+0x1cf96acc) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #53 DB::InterpreterSelectQuery::executeFetchColumns(DB::QueryProcessingStage::Enum, DB::QueryPlan&) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:2267:32 (clickhouse+0x1cf96acc)
    #54 DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::optional<DB::Pipe>) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:1344:9 (clickhouse+0x1cf8dad5) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #55 DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:770:5 (clickhouse+0x1cf8ce25) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #56 DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:308:38 (clickhouse+0x1d034484) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #57 DB::InterpreterSelectWithUnionQuery::execute() build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:382:5 (clickhouse+0x1d035358) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #58 DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) build_tsan/./src/Interpreters/executeQuery.cpp:715:36 (clickhouse+0x1d427955) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #59 DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) build_tsan/./src/Interpreters/executeQuery.cpp:1169:30 (clickhouse+0x1d423d2b) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #60 DB::TCPHandler::runImpl() build_tsan/./src/Server/TCPHandler.cpp:378:24 (clickhouse+0x1e8a5ba5) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #61 DB::TCPHandler::run() build_tsan/./src/Server/TCPHandler.cpp:1945:9 (clickhouse+0x1e8ba1a7) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #62 Poco::Net::TCPServerConnection::start() build_tsan/./contrib/poco/Net/src/TCPServerConnection.cpp:43:3 (clickhouse+0x22213c42) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #63 Poco::Net::TCPServerDispatcher::run() build_tsan/./contrib/poco/Net/src/TCPServerDispatcher.cpp:115:20 (clickhouse+0x222144b2) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #64 Poco::PooledThread::run() build_tsan/./contrib/poco/Foundation/src/ThreadPool.cpp:199:14 (clickhouse+0x2246e8d9) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #65 Poco::(anonymous namespace)::RunnableHolder::run() build_tsan/./contrib/poco/Foundation/src/Thread.cpp:55:11 (clickhouse+0x2246cc8f) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #66 Poco::ThreadImpl::runnableEntry(void*) build_tsan/./contrib/poco/Foundation/src/Thread_POSIX.cpp:345:27 (clickhouse+0x2246b2c7) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)

  Previous write of size 8 at 0x7b30009136b0 by thread T3:
    #0 operator delete(void*, unsigned long) /home/milovidov/work/llvm-project/compiler-rt/lib/tsan/rtl/tsan_new_delete.cpp:150:3 (clickhouse+0xc0c772e) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #1 void std::__1::__libcpp_operator_delete[abi:v15000]<void*, unsigned long>(void*, unsigned long) build_tsan/./contrib/llvm-project/libcxx/include/new:256:3 (clickhouse+0x1e0bd808) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #2 void std::__1::__do_deallocate_handle_size[abi:v15000]<>(void*, unsigned long) build_tsan/./contrib/llvm-project/libcxx/include/new:282:10 (clickhouse+0x1e0bd808)
    #3 std::__1::__libcpp_deallocate[abi:v15000](void*, unsigned long, unsigned long) build_tsan/./contrib/llvm-project/libcxx/include/new:296:14 (clickhouse+0x1e0bd808)
    #4 std::__1::allocator<char>::deallocate[abi:v15000](char*, unsigned long) build_tsan/./contrib/llvm-project/libcxx/include/__memory/allocator.h:128:13 (clickhouse+0x1e0bd808)
    #5 std::__1::allocator_traits<std::__1::allocator<char>>::deallocate[abi:v15000](std::__1::allocator<char>&, char*, unsigned long) build_tsan/./contrib/llvm-project/libcxx/include/__memory/allocator_traits.h:282:13 (clickhouse+0x1e0bd808)
    #6 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::~basic_string() build_tsan/./contrib/llvm-project/libcxx/include/string:2334:9 (clickhouse+0x1e0bd808)
    #7 DB::detail::StringHolder::~StringHolder() build_tsan/./src/IO/WriteBufferFromString.h:20:11 (clickhouse+0x1e0bd808)
    #8 DB::WriteBufferFromOwnString::~WriteBufferFromOwnString() build_tsan/./src/IO/WriteBufferFromString.h:28:7 (clickhouse+0x1e0bd808)
    #9 DB::KeyCondition::RPNElement::toString(std::__1::basic_string_view<char, std::__1::char_traits<char>>, bool) const build_tsan/./src/Storages/MergeTree/KeyCondition.cpp:2418:1 (clickhouse+0x1e0bd808)
    #10 DB::KeyCondition::getDescription() const::$_29::operator()(DB::KeyCondition::getDescription() const::Node const*) const build_tsan/./src/Storages/MergeTree/KeyCondition.cpp:1874:39 (clickhouse+0x1e0c3d50) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #11 decltype(std::declval<DB::KeyCondition::getDescription() const::$_29&>()(std::declval<DB::KeyCondition::getDescription() const::Node const*>())) std::__1::__invoke[abi:v15000]<DB::KeyCondition::getDescription() const::$_29&, DB::KeyCondition::getDescription() const::Node const*>(DB::KeyCondition::getDescription() const::$_29&, DB::KeyCondition::getDescription() const::Node const*&&) build_tsan/./contrib/llvm-project/libcxx/include/__functional/invoke.h:394:23 (clickhouse+0x1e0c3d50)
    #12 void std::__1::__invoke_void_return_wrapper<void, true>::__call<DB::KeyCondition::getDescription() const::$_29&, DB::KeyCondition::getDescription() const::Node const*>(DB::KeyCondition::getDescription() const::$_29&, DB::KeyCondition::getDescription() const::Node const*&&) build_tsan/./contrib/llvm-project/libcxx/include/__functional/invoke.h:479:9 (clickhouse+0x1e0c3d50)
    #13 std::__1::__function::__default_alloc_func<DB::KeyCondition::getDescription() const::$_29, void (DB::KeyCondition::getDescription() const::Node const*)>::operator()[abi:v15000](DB::KeyCondition::getDescription() const::Node const*&&) build_tsan/./contrib/llvm-project/libcxx/include/__functional/function.h:235:12 (clickhouse+0x1e0c3d50)
    #14 void std::__1::__function::__policy_invoker<void (DB::KeyCondition::getDescription() const::Node const*)>::__call_impl<std::__1::__function::__default_alloc_func<DB::KeyCondition::getDescription() const::$_29, void (DB::KeyCondition::getDescription() const::Node const*)>>(std::__1::__function::__policy_storage const*, DB::KeyCondition::getDescription() const::Node const*) build_tsan/./contrib/llvm-project/libcxx/include/__functional/function.h:716:16 (clickhouse+0x1e0c3d50)
    #15 std::__1::__function::__policy_func<void (DB::KeyCondition::getDescription() const::Node const*)>::operator()[abi:v15000](DB::KeyCondition::getDescription() const::Node const*&&) const build_tsan/./contrib/llvm-project/libcxx/include/__functional/function.h:848:16 (clickhouse+0x1e0c3e71) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #16 std::__1::function<void (DB::KeyCondition::getDescription() const::Node const*)>::operator()(DB::KeyCondition::getDescription() const::Node const*) const build_tsan/./contrib/llvm-project/libcxx/include/__functional/function.h:1187:12 (clickhouse+0x1e0c3e71)
    #17 DB::KeyCondition::getDescription() const::$_29::operator()(DB::KeyCondition::getDescription() const::Node const*) const build_tsan/./src/Storages/MergeTree/KeyCondition.cpp:1889:17 (clickhouse+0x1e0c3e71)
    #18 decltype(std::declval<DB::KeyCondition::getDescription() const::$_29&>()(std::declval<DB::KeyCondition::getDescription() const::Node const*>())) std::__1::__invoke[abi:v15000]<DB::KeyCondition::getDescription() const::$_29&, DB::KeyCondition::getDescription() const::Node const*>(DB::KeyCondition::getDescription() const::$_29&, DB::KeyCondition::getDescription() const::Node const*&&) build_tsan/./contrib/llvm-project/libcxx/include/__functional/invoke.h:394:23 (clickhouse+0x1e0c3e71)
    #19 void std::__1::__invoke_void_return_wrapper<void, true>::__call<DB::KeyCondition::getDescription() const::$_29&, DB::KeyCondition::getDescription() const::Node const*>(DB::KeyCondition::getDescription() const::$_29&, DB::KeyCondition::getDescription() const::Node const*&&) build_tsan/./contrib/llvm-project/libcxx/include/__functional/invoke.h:479:9 (clickhouse+0x1e0c3e71)
    #20 std::__1::__function::__default_alloc_func<DB::KeyCondition::getDescription() const::$_29, void (DB::KeyCondition::getDescription() const::Node const*)>::operator()[abi:v15000](DB::KeyCondition::getDescription() const::Node const*&&) build_tsan/./contrib/llvm-project/libcxx/include/__functional/function.h:235:12 (clickhouse+0x1e0c3e71)
    #21 void std::__1::__function::__policy_invoker<void (DB::KeyCondition::getDescription() const::Node const*)>::__call_impl<std::__1::__function::__default_alloc_func<DB::KeyCondition::getDescription() const::$_29, void (DB::KeyCondition::getDescription() const::Node const*)>>(std::__1::__function::__policy_storage const*, DB::KeyCondition::getDescription() const::Node const*) build_tsan/./contrib/llvm-project/libcxx/include/__functional/function.h:716:16 (clickhouse+0x1e0c3e71)
    #22 std::__1::__function::__policy_func<void (DB::KeyCondition::getDescription() const::Node const*)>::operator()[abi:v15000](DB::KeyCondition::getDescription() const::Node const*&&) const build_tsan/./contrib/llvm-project/libcxx/include/__functional/function.h:848:16 (clickhouse+0x1e0b872e) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #23 std::__1::function<void (DB::KeyCondition::getDescription() const::Node const*)>::operator()(DB::KeyCondition::getDescription() const::Node const*) const build_tsan/./contrib/llvm-project/libcxx/include/__functional/function.h:1187:12 (clickhouse+0x1e0b872e)
    #24 DB::KeyCondition::getDescription() const build_tsan/./src/Storages/MergeTree/KeyCondition.cpp:1902:5 (clickhouse+0x1e0b872e)
    #25 DB::MergeTreeDataSelectExecutor::filterPartsByPartition(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>&, std::__1::optional<std::__1::unordered_set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::MergeTreeData const&, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const> const&, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>> const*, Poco::Logger*, std::__1::vector<DB::ReadFromMergeTree::IndexStat, std::__1::allocator<DB::ReadFromMergeTree::IndexStat>>&) build_tsan/./src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp:845:50 (clickhouse+0x1e21e365) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #26 DB::ReadFromMergeTree::selectRangesToReadImpl(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>, DB::MergeTreeData const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, bool, Poco::Logger*) build_tsan/./src/Processors/QueryPlan/ReadFromMergeTree.cpp:1070:9 (clickhouse+0x1ee42cd9) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #27 DB::ReadFromMergeTree::selectRangesToRead(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>, std::__1::shared_ptr<DB::PrewhereInfo> const&, DB::ActionDAGNodes const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>, DB::MergeTreeData const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, bool, Poco::Logger*) build_tsan/./src/Processors/QueryPlan/ReadFromMergeTree.cpp:967:16 (clickhouse+0x1ee417fb) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #28 DB::MergeTreeDataSelectExecutor::estimateNumMarksToRead(std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>>, std::__1::shared_ptr<DB::PrewhereInfo> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, DB::ActionDAGNodes const&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>) const build_tsan/./src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp:1323:12 (clickhouse+0x1e225387) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #29 DB::selectBestProjection(DB::MergeTreeDataSelectExecutor const&, std::__1::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo const&, DB::ActionDAGNodes const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, DB::ProjectionCandidate&, std::__1::shared_ptr<DB::Context const>, std::__1::shared_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, long, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, long>>>>, DB::Settings const&, std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const>>> const&, DB::ProjectionCandidate*&, unsigned long&) build_tsan/./src/Storages/MergeTree/MergeTreeData.cpp:6030:41 (clickhouse+0x1e176e8c) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #30 DB::MergeTreeData::getQueryProcessingStageWithAggregateProjection(std::__1::shared_ptr<DB::Context const>, std::__1::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo&) const build_tsan/./src/Storages/MergeTree/MergeTreeData.cpp:6746:17 (clickhouse+0x1e172ef5) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #31 DB::MergeTreeData::getQueryProcessingStage(std::__1::shared_ptr<DB::Context const>, DB::QueryProcessingStage::Enum, std::__1::shared_ptr<DB::StorageSnapshot> const&, DB::SelectQueryInfo&) const build_tsan/./src/Storages/MergeTree/MergeTreeData.cpp:6813:31 (clickhouse+0x1e177836) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #32 DB::InterpreterSelectQuery::getSampleBlockImpl() build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:831:31 (clickhouse+0x1cf914a0) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #33 DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>)::$_2::operator()(bool) const build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:684:25 (clickhouse+0x1cf88de7) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #34 DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:687:5 (clickhouse+0x1cf82dce) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #35 DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:200:7 (clickhouse+0x1cf7f8e5) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #36 std::__1::__unique_if<DB::InterpreterSelectQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectQuery, std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&>(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32 (clickhouse+0x1d03147e) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #37 DB::InterpreterSelectWithUnionQuery::buildCurrentChildInterpreter(std::__1::shared_ptr<DB::IAST> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:250:16 (clickhouse+0x1d03147e)
    #38 DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:148:13 (clickhouse+0x1d02ea98) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #39 DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:40:7 (clickhouse+0x1d02dae2) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #40 std::__1::__unique_if<DB::InterpreterSelectWithUnionQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectWithUnionQuery, std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&>(std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>&&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&) build_tsan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32 (clickhouse+0x1cf96acc) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #41 DB::InterpreterSelectQuery::executeFetchColumns(DB::QueryProcessingStage::Enum, DB::QueryPlan&) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:2267:32 (clickhouse+0x1cf96acc)
    #42 DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::optional<DB::Pipe>) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:1344:9 (clickhouse+0x1cf8dad5) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #43 DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:770:5 (clickhouse+0x1cf8ce25) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #44 DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:308:38 (clickhouse+0x1d034484) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #45 DB::InterpreterSelectWithUnionQuery::execute() build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:382:5 (clickhouse+0x1d035358) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #46 DB::ExecuteScalarSubqueriesMatcher::visit(DB::ASTSubquery const&, std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_tsan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:187:36 (clickhouse+0x1d3c9d8d) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #47 DB::ExecuteScalarSubqueriesMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_tsan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:66:9 (clickhouse+0x1d3c9383) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #48 DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::doVisit(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:71:13 (clickhouse+0x1d357b6e) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #49 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:61:9 (clickhouse+0x1d357cd8) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #50 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:51:13 (clickhouse+0x1d357cd8)
    #51 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitChildren<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:92:17 (clickhouse+0x1d357cd8)
    #52 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:64:13 (clickhouse+0x1d3ce1ca) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #53 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:51:13 (clickhouse+0x1d3ce1ca)
    #54 DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visit(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:32:13 (clickhouse+0x1d3ce1ca)
    #55 DB::ExecuteScalarSubqueriesMatcher::visit(DB::ASTFunction const&, std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_tsan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:317:23 (clickhouse+0x1d3ce1ca)
    #56 DB::ExecuteScalarSubqueriesMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::ExecuteScalarSubqueriesMatcher::Data&) build_tsan/./src/Interpreters/ExecuteScalarSubqueriesVisitor.cpp:68:9 (clickhouse+0x1d3c93db) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #57 DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::doVisit(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:71:13 (clickhouse+0x1d357b6e) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #58 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:61:9 (clickhouse+0x1d357cd8) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #59 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:51:13 (clickhouse+0x1d357cd8)
    #60 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitChildren<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:92:17 (clickhouse+0x1d357cd8)
    #61 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:64:13 (clickhouse+0x1d357ce3) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #62 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:51:13 (clickhouse+0x1d357ce3)
    #63 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitChildren<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:92:17 (clickhouse+0x1d357ce3)
    #64 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImplMain<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:64:13 (clickhouse+0x1d34c005) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #65 void DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visitImpl<false>(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:51:13 (clickhouse+0x1d34c005)
    #66 DB::InDepthNodeVisitor<DB::ExecuteScalarSubqueriesMatcher, true, false, std::__1::shared_ptr<DB::IAST>>::visit(std::__1::shared_ptr<DB::IAST>&) build_tsan/./src/Interpreters/InDepthNodeVisitor.h:32:13 (clickhouse+0x1d34c005)
    #67 DB::(anonymous namespace)::executeScalarSubqueries(std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>, unsigned long, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, DB::Block, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, DB::Block>>>&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, DB::Block, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, DB::Block>>>&, bool) build_tsan/./src/Interpreters/TreeRewriter.cpp:490:64 (clickhouse+0x1d34c005)
    #68 DB::TreeRewriter::analyzeSelect(std::__1::shared_ptr<DB::IAST>&, DB::TreeRewriterResult&&, DB::SelectQueryOptions const&, std::__1::vector<DB::TableWithColumnNamesAndTypes, std::__1::allocator<DB::TableWithColumnNamesAndTypes>> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::TableJoin>, bool, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>>, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>>) const build_tsan/./src/Interpreters/TreeRewriter.cpp:1258:5 (clickhouse+0x1d347515) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #69 DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>)::$_2::operator()(bool) const build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:535:56 (clickhouse+0x1cf86723) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #70 DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::shared_ptr<DB::PreparedSets>) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:687:5 (clickhouse+0x1cf82dce) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #71 DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:200:7 (clickhouse+0x1cf7f8e5) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #72 std::__1::__unique_if<DB::InterpreterSelectQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectQuery, std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&>(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32 (clickhouse+0x1d03147e) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #73 DB::InterpreterSelectWithUnionQuery::buildCurrentChildInterpreter(std::__1::shared_ptr<DB::IAST> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:250:16 (clickhouse+0x1d03147e)
    #74 DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:148:13 (clickhouse+0x1d02ea98) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #75 DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:40:7 (clickhouse+0x1d02dae2) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #76 std::__1::__unique_if<DB::InterpreterSelectWithUnionQuery>::__unique_single std::__1::make_unique[abi:v15000]<DB::InterpreterSelectWithUnionQuery, std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&>(std::__1::shared_ptr<DB::IAST>&, std::__1::shared_ptr<DB::Context const>&&, DB::SelectQueryOptions&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>&) build_tsan/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:714:32 (clickhouse+0x1cf96acc) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #77 DB::InterpreterSelectQuery::executeFetchColumns(DB::QueryProcessingStage::Enum, DB::QueryPlan&) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:2267:32 (clickhouse+0x1cf96acc)
    #78 DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::optional<DB::Pipe>) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:1344:9 (clickhouse+0x1cf8dad5) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #79 DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) build_tsan/./src/Interpreters/InterpreterSelectQuery.cpp:770:5 (clickhouse+0x1cf8ce25) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #80 DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:308:38 (clickhouse+0x1d034484) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #81 DB::InterpreterSelectWithUnionQuery::execute() build_tsan/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:382:5 (clickhouse+0x1d035358) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #82 DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) build_tsan/./src/Interpreters/executeQuery.cpp:715:36 (clickhouse+0x1d427955) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #83 DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) build_tsan/./src/Interpreters/executeQuery.cpp:1169:30 (clickhouse+0x1d423d2b) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #84 DB::TCPHandler::runImpl() build_tsan/./src/Server/TCPHandler.cpp:378:24 (clickhouse+0x1e8a5ba5) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #85 DB::TCPHandler::run() build_tsan/./src/Server/TCPHandler.cpp:1945:9 (clickhouse+0x1e8ba1a7) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #86 Poco::Net::TCPServerConnection::start() build_tsan/./contrib/poco/Net/src/TCPServerConnection.cpp:43:3 (clickhouse+0x22213c42) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #87 Poco::Net::TCPServerDispatcher::run() build_tsan/./contrib/poco/Net/src/TCPServerDispatcher.cpp:115:20 (clickhouse+0x222144b2) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #88 Poco::PooledThread::run() build_tsan/./contrib/poco/Foundation/src/ThreadPool.cpp:199:14 (clickhouse+0x2246e8d9) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #89 Poco::(anonymous namespace)::RunnableHolder::run() build_tsan/./contrib/poco/Foundation/src/Thread.cpp:55:11 (clickhouse+0x2246cc8f) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #90 Poco::ThreadImpl::runnableEntry(void*) build_tsan/./contrib/poco/Foundation/src/Thread_POSIX.cpp:345:27 (clickhouse+0x2246b2c7) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)

  Thread T3 'TCPHandler' (tid=607005, running) created by main thread at:
    #0 pthread_create /home/milovidov/work/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1022:3 (clickhouse+0xc045b0d) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #1 Poco::ThreadImpl::startImpl(Poco::SharedPtr<Poco::Runnable, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::Runnable>>) build_tsan/./contrib/poco/Foundation/src/Thread_POSIX.cpp:202:6 (clickhouse+0x2246acd3) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #2 Poco::Thread::start(Poco::Runnable&) build_tsan/./contrib/poco/Foundation/src/Thread.cpp:128:2 (clickhouse+0x2246c6cc) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #3 Poco::PooledThread::start() build_tsan/./contrib/poco/Foundation/src/ThreadPool.cpp:85:10 (clickhouse+0x2246edd0) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #4 Poco::ThreadPool::ThreadPool(int, int, int, int) build_tsan/./contrib/poco/Foundation/src/ThreadPool.cpp:252:12 (clickhouse+0x2246edd0)
    #5 DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_tsan/./programs/server/Server.cpp:774:22 (clickhouse+0x13b5cee0) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #6 Poco::Util::Application::run() build_tsan/./contrib/poco/Util/src/Application.cpp:334:8 (clickhouse+0x2222cb7d) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #7 DB::Server::run() build_tsan/./programs/server/Server.cpp:474:25 (clickhouse+0x13b57b9a) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #8 Poco::Util::ServerApplication::run(int, char**) build_tsan/./contrib/poco/Util/src/ServerApplication.cpp:611:9 (clickhouse+0x2224ca2f) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #9 mainEntryClickHouseServer(int, char**) build_tsan/./programs/server/Server.cpp:195:20 (clickhouse+0x13b546f4) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)
    #10 main build_tsan/./programs/main.cpp:482:12 (clickhouse+0xc0c8b11) (BuildId: 906d6674475c905b302a0ca26dc5fe78da8ee3ba)

SUMMARY: ThreadSanitizer: heap-use-after-free build_tsan/./src/Storages/MergeTree/KeyCondition.cpp:1855:31 in DB::KeyCondition::getDescription() const
==================

@amosbird
Copy link
Collaborator

amosbird commented Jan 27, 2023

The bug is easily revealed in Debug build. It's not related to projection, but some issue in KeyCondition::getDescription() with duplicate primary keys. Will submit a PR soon.

@amosbird
Copy link
Collaborator

Thread 519 "QueryPipelineEx" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffe7a156640 (LWP 501852)]
0x000000000d781a0e in DB::ColumnDescription::~ColumnDescription() ()
(gdb) bt
#0  0x000000000d781a0e in DB::ColumnDescription::~ColumnDescription() ()
#1  0x00000000164610dd in DB::IMergeTreeReader::~IMergeTreeReader() ()
#2  0x000000001646103a in DB::MergeTreeReaderCompact::~MergeTreeReaderCompact() ()
#3  0x0000000016ca82e3 in DB::IMergeTreeSelectAlgorithm::initializeMergeTreeReadersForPart(std::__1::shared_ptr<DB::IMergeTreeDataPart const>&, DB::MergeTreeReadTaskColumns const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::deque<DB::MarkRange, std::__1::allocator<DB::MarkRange> > const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, double> > > const&, std::__1::function<void (DB::ReadBufferFromFileBase::ProfileInfo)> const&) ()
#4  0x0000000016cc3078 in DB::MergeTreeThreadSelectAlgorithm::finalizeNewTask() ()
#5  0x0000000016ca79fe in DB::IMergeTreeSelectAlgorithm::read() ()
#6  0x0000000016cc0fa3 in DB::MergeTreeSource::tryGenerate() ()
#7  0x00000000169588a4 in DB::ISource::work() ()
#8  0x00000000169700a2 in DB::ExecutionThreadContext::executeTask() ()
#9  0x000000001696675a in DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic<bool>*) ()
#10 0x0000000016967c51 in void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<DB::PipelineExecutor::spawnThreads()::$_0>(DB::PipelineExecutor::spawnThreads()::$_0&&)::{lambda()#1}, void ()> >(std::__1::__function::__policy_storage const*) ()
#11 0x0000000010232160 in ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) ()
#12 0x00000000102355ce in 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> >, ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, long, std::__1::optional<unsigned long>, bool)::{lambda()#2}> >(void*) ()
#13 0x00007ffff7e00b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#14 0x00007ffff7e92a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

This one is unfamiliar. How did it happen?

@amosbird amosbird self-assigned this Jan 27, 2023
@amosbird
Copy link
Collaborator

The bug is easily revealed in Debug build. It's not related to projection, but some issue in KeyCondition::getDescription() with duplicate primary keys. Will submit a PR soon.

But we don't allow creating MergeTree tables with duplicate primary keys. It's however allowed in projections. So it's still related.

amosbird added a commit to amosbird/ClickHouse that referenced this issue Jan 27, 2023
This can happen in projections. See
ClickHouse#45590 for details.
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 comp-projections crash Crash / segfault / abort major
Projects
None yet
Development

No branches or pull requests

5 participants