Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED#92390
Merged
azat merged 1 commit intoClickHouse:masterfrom Dec 17, 2025
Merged
Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED#92390azat merged 1 commit intoClickHouse:masterfrom
azat merged 1 commit intoClickHouse:masterfrom
Conversation
Contributor
|
Workflow [PR], commit [1cd46f9] Summary: ❌
|
ac79586 to
a2747c2
Compare
azat
commented
Dec 17, 2025
f19944d to
a7fac1a
Compare
novikd
reviewed
Dec 17, 2025
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.
a7fac1a to
1cd46f9
Compare
Merged
via the queue into
ClickHouse:master
with commit Dec 17, 2025
2ba6d59
125 of 131 checks passed
robot-clickhouse
added a commit
that referenced
this pull request
Dec 17, 2025
Cherry pick #92390 to 25.8: Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED
robot-clickhouse
added a commit
that referenced
this pull request
Dec 17, 2025
…ter MEMORY_LIMIT_EXCEEDED
robot-clickhouse
added a commit
that referenced
this pull request
Dec 17, 2025
Cherry pick #92390 to 25.9: Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED
robot-clickhouse
added a commit
that referenced
this pull request
Dec 17, 2025
…ter MEMORY_LIMIT_EXCEEDED
robot-clickhouse
added a commit
that referenced
this pull request
Dec 17, 2025
Cherry pick #92390 to 25.10: Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED
robot-clickhouse
added a commit
that referenced
this pull request
Dec 17, 2025
…fter MEMORY_LIMIT_EXCEEDED
robot-clickhouse
added a commit
that referenced
this pull request
Dec 17, 2025
Cherry pick #92390 to 25.11: Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED
robot-clickhouse
added a commit
that referenced
this pull request
Dec 17, 2025
…fter MEMORY_LIMIT_EXCEEDED
robot-ch-test-poll2
added a commit
that referenced
this pull request
Dec 17, 2025
Cherry pick #92390 to 25.3: Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED
robot-clickhouse
added a commit
that referenced
this pull request
Dec 17, 2025
…ter MEMORY_LIMIT_EXCEEDED
azat
added a commit
that referenced
this pull request
Dec 18, 2025
Backport #92390 to 25.8: Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED
azat
added a commit
that referenced
this pull request
Dec 18, 2025
Backport #92390 to 25.10: Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED
azat
added a commit
that referenced
this pull request
Dec 18, 2025
Backport #92390 to 25.3: Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED
azat
added a commit
that referenced
this pull request
Dec 18, 2025
Backport #92390 to 25.11: Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix possible crash in aggregate functions after MEMORY_LIMIT_EXCEEDED
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.