Repository navigation
Fix use-after-scope in parallel Object type deserialization - #101823
Merged
Merged
Conversation
Add a `SCOPE_EXIT` to drain all scheduled tasks on every exit path (including exceptions), preventing pool threads from dereferencing dangling references to stack locals. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [256dc57] Summary: ❌
AI ReviewSummaryThis PR adds a Missing context
ClickHouse Rules
Final Verdict
|
Member
|
The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix. |
Avogar
approved these changes
Apr 7, 2026
Contributor
LLVM Coverage Report
Changed lines: 100.00% (11/11) · Uncovered code |
clickhouse-gh Bot
added a commit
that referenced
this pull request
Apr 8, 2026
Backport #101823 to 26.2: Fix use-after-scope in parallel Object type deserialization
clickhouse-gh Bot
added a commit
that referenced
this pull request
Apr 8, 2026
Backport #101823 to 26.3: Fix use-after-scope in parallel Object type deserialization
antonio2368
added a commit
that referenced
this pull request
Apr 9, 2026
Backport #101823 to 26.1: Fix use-after-scope in parallel Object type deserialization
antonio2368
added a commit
that referenced
this pull request
Apr 9, 2026
Backport #101823 to 25.8: Fix use-after-scope in parallel Object type deserialization
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.
Linked issues
In
SerializationObject::deserializeBinaryBulkStatePrefix, when parallel deserialization of dynamic paths is enabled viaprefixes_deserialization_thread_pool, tasks are scheduled into a thread pool and capture references to stack-local variables (e.g.safe_getter,safe_dynamic_subcolumns_callback, etc.). If an exception is thrown during task scheduling or later in the function, the stack unwinds and destroys those locals while pool threads may still be running, causing use-after-scope / use-after-free.This adds a
SCOPE_EXITthat drains all scheduled tasks on every exit path (including exceptions), ensuring pool threads finish before the captured references go out of scope.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix use-after-scope in parallel deserialization of
Objecttype dynamic paths, which could cause crashes when reading tables with many dynamic paths.Documentation entry for user-facing changes
Version info
26.4.1.64626.3.5.8,26.2.9.5,26.1.8.27,25.8.22.19