Skip to content

Cherry pick #92390 to 25.10: Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED#92428

Merged
robot-clickhouse merged 2 commits intobackport/25.10/92390from
cherrypick/25.10/92390
Dec 17, 2025
Merged

Cherry pick #92390 to 25.10: Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED#92428
robot-clickhouse merged 2 commits intobackport/25.10/92390from
cherrypick/25.10/92390

Conversation

@robot-clickhouse
Copy link
Copy Markdown
Member

Original pull-request #92390

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

azat added 2 commits December 17, 2025 16:33
The problem is when ColumnAggregateFunction is reused after exception,
this is the case of async_insert=1, where we are trying to load each
INSERT batch, and if it fails, continue with other batches.

The problem was that once ColumnAggregateFunction::ensureOwnership()
throws, it leaves the column in a broken state, since all aggregation
states up to rollback_pos will be broken.

The fix is simple - just copy them from source column again.

And add a unit test.
Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED
@robot-clickhouse robot-clickhouse added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-critical-bugfix labels Dec 17, 2025
@robot-clickhouse robot-clickhouse merged commit 5b38d65 into backport/25.10/92390 Dec 17, 2025
108 of 109 checks passed
@robot-clickhouse robot-clickhouse deleted the cherrypick/25.10/92390 branch December 17, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! pr-critical-bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants