Skip to content

Do not strand processors queued for removal in ExecutingGraph - #115800

Closed
alexey-milovidov wants to merge 2 commits into
masterfrom
fix-pending-removal-on-cancel
Closed

alexey-milovidov wants to merge 2 commits into
masterfrom
fix-pending-removal-on-cancel

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 21, 2026 •

Copy link
Copy Markdown
Member

Related: #115625

Processor removal in ExecutingGraph recently became deferred: updatePipeline only records update.to_remove into a pending group, and updateNode retires that group once every processor in it reports Finished.

Two paths leave a recorded group behind, so its processors stay in the pipeline until the whole query is destroyed:

  • updatePipeline records the group and then returns Cancelled, which makes updateNode return before it reaches the code that retires groups;
  • the retiring code handles a single group per prepared node, so a backlog can outlive the last updateNode call.

This change retires every group that is ready instead of just one, and also retires them on the way out when updatePipeline does not return Done.

This is what Processors.UpdatePipelineMultipleCoordinatorsMultithreaded caught on master — it cancels the executor while 16 coordinators are cycling, so one of them gets its removal stranded and an extra source is still alive at the end of the test:

https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=b16561cc816cf56cadd0c35ed9ad48964ad7758d&name_0=MasterCI&name_1=Unit%20tests%20%28amd_llvm_coverage%29

src/Processors/tests/gtest_update_pipeline.cpp:504
Expected: (alive) <= (1u), actual: 2 vs 1

The existing test only reproduces this rarely, so a deterministic one is added: Processors.UpdatePipelineRemovalIsNotStrandedByCancellation cancels the pipeline from inside prepare, so the updatePipeline that retires the source is exactly the one that observes the cancellation. It fails before this change and passes after it.

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Workflow [PR]
Sync PR [sync-upstream/pr/115800]

Processor removal became deferred: `updatePipeline` only records
`update.to_remove` into a pending group and `updateNode` retires the group
once every processor in it reports `Finished`. Two paths leave a recorded
group behind, so the processors stay in the pipeline until the whole query
is destroyed:

- `updatePipeline` records the group and then returns `Cancelled`, which
  makes `updateNode` return before it reaches the code that retires groups;
- the retiring code handles a single group per prepared node, so a backlog
  can outlive the last `updateNode` call.

Retire every group that is ready instead of one, and also do it on the way
out when `updatePipeline` does not return `Done`.

This is what `Processors.UpdatePipelineMultipleCoordinatorsMultithreaded`
caught on master: it cancels the executor while 16 coordinators are cycling,
so one of them gets its removal stranded and an extra source is still alive
at the end of the test.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=b16561cc816cf56cadd0c35ed9ad48964ad7758d&name_0=MasterCI&name_1=Unit%20tests%20%28amd_llvm_coverage%29

Caused by: #115625

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [069005e]

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Aug 21, 2026
@Michicosun Michicosun self-assigned this Aug 21, 2026
@Michicosun
Michicosun enabled auto-merge August 21, 2026 15:15
alexey-milovidov added a commit that referenced this pull request Aug 21, 2026


Brings in #115800, which the
re-landed change needs: processors queued for removal were left in the graph
when `updatePipeline` returned `Cancelled`, or when more than one group became
removable between two prepared nodes.

Co-Authored-By: Claude Fable 5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Merged into #115810 (the re-land of #115625), which is where this change belongs — closing here.

auto-merge was automatically disabled August 21, 2026 15:38

Pull request was closed

alexey-milovidov added a commit that referenced this pull request Aug 28, 2026
…ategory

**`release_range_prs` read every `(#N)` in a subject.** A squashed revert
quotes the original title, `Revert "Something (#90000)" (#115800)`, and the
quoted number would put a pull request of an earlier release into this range -
the very distinction the caller uses the range for, so a revert of it would
look like something this release cancels out rather than a user-visible
reversal. Both shapes are now anchored: the squash number ends the subject, the
`Merge pull request #N` one starts it.

That shape does not occur in the last 60000 commits of this repository, where
reverts land as merge commits, so this is hardening rather than a live bug. The
anchored form is the right parse either way, and the regression pins it along
with a fork's own `Merge pull request #4` appearing mid-line.

**A sibling moved between categories made the merge impossible.** The category
check demanded the recorded header while the shared-bullet rule demanded a
merge into the surviving bullet, so once an edit had moved that bullet the two
contradicted each other and no edit could pass. The expected category is now
the surviving bullet's current one when there is a sibling to merge into, and
the recorded one otherwise: the check follows the bullet rather than a
remembered header.

The two rules then compose instead of fighting - moving the whole merged bullet
elsewhere stays legal, while leaving the survivor and restoring the entry beside
it under the old header is rejected, which the test asserts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants