Repository navigation
Allow allocation during job destructor in ThreadPool - #63829
Merged
Merged
Conversation
Contributor
|
This is an automated comment for commit d4b3581 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
Successful checks
|
opensource-fork-sync Bot
pushed a commit
to cla7aye15I4nd/opensource-ClickHouse__ClickHouse
that referenced
this pull request
Nov 22, 2026
`AsyncLoader::worker`, `remove` and `schedule` run their bookkeeping under `DENY_ALLOCATIONS_IN_SCOPE`, and `LoadJob::finish` resets `func` and `dependency_failure` inside it, destroying whatever the job captured. A table-load job from `DatabaseOrdinary::loadTableFromMetadataAsync` holds the last reference to the CREATE query AST. Since ClickHouse#110393, destroying a `Field` with more than 16 non-empty nested containers allocates (the inline worklist of `Field::destroyContainerIteratively`), so a debug server aborts with `Memory tracker: allocations not allowed` at startup when a table whose definition holds such a literal (e.g. `DEFAULT [[1], [2], ..., [17]]`) finishes loading. Seen in `La Casa Del Dolor (amd_debug)` (STID 4176-5176). Destroy the two callbacks under `ALLOW_ALLOCATIONS_IN_SCOPE`, as `ThreadPool` does for its jobs (ClickHouse#63829). `LoadJob::finish` is the only place where the loader destroys job callbacks, so the worker, `remove()` and the cancel in `schedule()` are all covered, and the callbacks are still destroyed before `finished.notify_all()`. Both macros are no-ops with `NDEBUG`. The new gtests cover the three paths; each aborts without the fix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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):
Not sure about this one. It's related to this failure https://s3.amazonaws.com/clickhouse-test-reports/0/224dad9e168dc6eeb0baa2e0ba3313b7c4c94188/stress_test__debug_.html
In short, the destructor is called on packaged_task while a future of it is alive (created by
ThreadPoolCallbackRunnerLocal).We could try to locate the future now, but I think it will be easier to allow the allocation so that an exception is created, and the call on the invalid future will throw
future_error.Documentation entry for user-facing changes
Modify your CI run
NOTE: If your merge the PR with modified CI you MUST KNOW what you are doing
NOTE: Checked options will be applied if set before CI RunConfig/PrepareRunConfig step
Include tests (required builds will be added automatically):
Exclude tests:
Extra options:
Only specified batches in multi-batch jobs: