Skip to content

Revert "Multistage distributed queries" (#106020) — fixes ASan heap corruption on master - #107122

Merged
alexey-milovidov merged 4 commits into
masterfrom
revert-106020-multistage-distributed
Jun 11, 2026
Merged

Revert "Multistage distributed queries" (#106020) — fixes ASan heap corruption on master#107122
alexey-milovidov merged 4 commits into
masterfrom
revert-106020-multistage-distributed

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Jun 11, 2026

Copy link
Copy Markdown
Member

This reverts the "multistage distributed queries" feature (#106020) and its dependent follow-ups, because it destabilized master: sanitizer builds started aborting with internal Address Sanitizer allocator CHECK failures (heap corruption).

Motivation

On 2026-06-10, Stateless tests on sanitizer builds began failing en masse with Server died and:

AddressSanitizer: CHECK failed: sanitizer_allocator_secondary.h:200 "((nearest_chunk)) < ((h->map_beg + h->map_size))"

This is generic heap corruption detected by Address Sanitizer on free/memcpy — the reported stack is incidental and varies across unrelated code paths (ColumnString/ColumnVector destructors, WriteBuffer buffers, ActionsDAG, re2, Arena, MergeTree part removal, etc.), on both amd and arm.

The trigger is the thread_pool_trim.xml config introduced by the follow-up #106978 ("Shrink idle thread pools of the distributed query infrastructure"), installed for sanitizer builds, which lowers max_thread_pool_free_size from 1000 to 128. With the default of 1000 the global pool never shrank in tests; at 128 idle threads are actively destroyed, exposing a thread-teardown use-after-free in the distributed-query infrastructure as broad heap corruption. The first pure-master run to fail is the merge commit of #106978, and the secondary.h CHECK (now surfaced by the log-parser change in #106848) appears only after it.

Since #106978 and the fix "Fix logical error when table is dropped before distributed plan task deserialization" depend on #106020, they are reverted together. The result is byte-identical to the pre-#106020 state for all touched files (except programs/server/Server.cpp, which retains unrelated later changes).

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=b825a23a5cb63137a94dc0971fd4cf1ef73f789b&name_0=MasterCI&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20azure%2C%20sequential%29

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.6.1.620

…hrink-idle-thread-pools"

This reverts commit 4f2c879, reversing
changes made to 56d78b5.
…uted_queries"

This reverts commit c3131f3, reversing
changes made to 4f3fe68.
…stage-distributed

# Conflicts:
#	programs/server/Server.cpp
#	src/Server/DistributedQuery/ExchangeServer.cpp
#	src/Server/StatelessWorker/StatelessTaskExecutor.cpp
#	src/Server/StatelessWorker/StatelessTaskExecutor.h
#	src/Server/StatelessWorker/StatelessWorkerEndpoint.cpp
#	src/Server/StatelessWorker/StatelessWorkerEndpoint.h
@clickhouse-gh

clickhouse-gh Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [50c8123]

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jun 11, 2026
@alexey-milovidov
alexey-milovidov merged commit 8204c02 into master Jun 11, 2026
12 of 16 checks passed
@alexey-milovidov
alexey-milovidov deleted the revert-106020-multistage-distributed branch June 11, 2026 01:37
@alexey-milovidov alexey-milovidov self-assigned this Jun 11, 2026
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 11, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Jun 17, 2026
…ted queries) and ClickHouse#107056

The prior CI run executed on a merge-base ~980 commits behind these fixes,
so it inherited the master-wide ASan heap corruption from ClickHouse#106020 (segfaults
during String serialization in DistributedSink / MergeTask / MergeMutate,
STIDs 1288-3bd5, 2046-50c3, 0988-1d81) plus the known-flaky
02865_tcp_proxy_query_packet_validation. Both are fixed on current master.
No conflicts; CREATE OR REPLACE size-check changes are unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants