Repository navigation
Fix stack-use-after-scope in MergeTreeIndexVectorSimilarity - #96259
Merged
alexey-milovidov merged 1 commit intoFeb 7, 2026
Merged
Conversation
The `ThreadPoolCallbackRunnerLocal` runner was declared before the `add_vector_to_index` lambda it dispatches. During exception-driven stack unwinding, C++ destroys locals in reverse order, so the lambda was destroyed first while thread pool tasks could still be accessing it, and only then the runner's destructor waited for tasks to finish. Fix by declaring the lambda before the runner, so the runner is destroyed first (waits for all tasks) and the lambda is destroyed second. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96252&sha=23d9de6f6f480a69f423153e6bc107063a9dcba6&name_0=PR&name_1=Stress%20test%20%28arm_asan%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [67a04ab] Summary: ❌
|
shankar-iyer
approved these changes
Feb 7, 2026
alexey-milovidov
deleted the
fix-vector-similarity-stack-use-after-scope
branch
February 7, 2026 06:36
Member
|
#95818 is more complete (cc @Algunenano ) |
This was referenced Feb 7, 2026
Closed
Closed
This was referenced Feb 7, 2026
This was referenced Feb 7, 2026
clickhouse-gh Bot
added a commit
that referenced
this pull request
Feb 7, 2026
Backport #96259 to 26.1: Fix stack-use-after-scope in `MergeTreeIndexVectorSimilarity`
This was referenced Feb 7, 2026
alexey-milovidov
added a commit
that referenced
this pull request
Feb 8, 2026
Backport #96259 to 25.12: Fix stack-use-after-scope in `MergeTreeIndexVectorSimilarity`
alexey-milovidov
added a commit
that referenced
this pull request
Feb 8, 2026
Backport #96259 to 25.11: Fix stack-use-after-scope in `MergeTreeIndexVectorSimilarity`
1 task
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.
The
ThreadPoolCallbackRunnerLocalrunner was declared before theadd_vector_to_indexlambda it dispatches. During exception-driven stack unwinding, C++ destroys locals in reverse order, so the lambda was destroyed first while thread pool tasks could still be accessing it, and only then the runner's destructor waited for tasks to finish.Fix by declaring the lambda before the runner, so the runner is destroyed first (waits for all tasks) and the lambda is destroyed second.
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96252&sha=23d9de6f6f480a69f423153e6bc107063a9dcba6&name_0=PR&name_1=Stress%20test%20%28arm_asan%29
#96252
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
stack-use-after-scopein the vector similarity index.Version info
26.2.1.37426.1.3.24,25.12.6.17,25.11.9.24