Repository navigation
Keep the huge max_streams_to_max_threads_ratio of test 04842 out of the AST fuzzer - #123125
Conversation
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 2 rounds, 2 findings then 0) plus my own review (3 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20260930-181511 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20260930-175800 |
|
Workflow [PR], commit [a0c746c] Summary: ✅ AI ReviewSummaryThis PR turns Final Verdict
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units23 translation units recompiled, 173 s compile time in total, 23 of them have a recent master baseline. |
|
@groeneai how |
|
It was not generated: I picked The ratio in the failing master job was |
|
@groeneai then you should fix the test, please refractor this PR. |
The AST fuzzer runs the test corpus in one session, so the session `SET max_streams_to_max_threads_ratio = 288230376151711744` in 04842 stayed in effect for every later query. Under it the server-side fuzzer turned `numbers_mt(1048576)` into `numbers_mt(9223372036854775807)`, and the server was OOM-killed while building one source per block: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=6b601838b5c7526a500254219a92542f852d5e55&name_0=MasterCI&name_1=AST%20fuzzer%20%28amd_release%2C%20oracle%29 Pass the ratio in the SETTINGS clause of the four queries that need it. 04842 was the only test that set it for the whole session. Co-Authored-By: Claude Opus 5.5 <[email protected]>
7d968fa to
ca94d59
Compare
max_streams_to_max_threads_ratio of test 04842 per query, not for the session
|
Done in ca94d59: the PR is now only the test change. |
The server-side AST fuzzer clones the executed query with its SETTINGS clause and strips only the row/time/memory/block limits, so every fuzzed copy of the four 04842 queries still ran with `max_streams_to_max_threads_ratio = 288230376151711744`. Some of those copies read `numbers_mt(1048576)` through an added JOIN or ARRAY JOIN, one literal mutation away from the `numbers_mt(9223372036854775807)` read that got the server OOM-killed on master. Disable the server-side fuzzer on these queries with `ast_fuzzer_runs = 0`, like 02920, 03714 and 04141 do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The client-side AST fuzzer reads every `*.sql` file of `0_stateless` (`run-fuzzer.sh`, and the targeted corpus in `ast_fuzzer_job.py`), and fuzzes each SELECT 1000 times with its inline `SETTINGS` kept. A fuzzed copy of a 04842 query can join a table function collected from another corpus query, such as `numbers_mt(...)`, and run it with `max_streams_to_max_threads_ratio = 2^58`, which is how the master AST fuzzer OOM started. `FuzzLoop.cpp` has no per-query opt-out, so the test becomes a shell test, which neither client-side corpus reads. The SQL is unchanged: the ratio stays per query and `ast_fuzzer_runs = 0` stays, because the stress test's server-side fuzzer still sees the queries of shell tests. Failing master job: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=6b601838b5c7526a500254219a92542f852d5e55&name_0=MasterCI&name_1=AST%20fuzzer%20%28amd_release%2C%20oracle%29 Co-Authored-By: Claude Opus 5.5 <[email protected]>
max_streams_to_max_threads_ratio of test 04842 per query, not for the sessionmax_streams_to_max_threads_ratio of test 04842 out of the AST fuzzer
A nested SETTINGS clause is applied to the query node's own context after `clampToSettingsConstraints` and `doSettingsSanityCheckClamp`, and the Planner of that node runs on that context. The aggregation block of `Planner::buildPlanForQueryNode` re-applied `query_node.getSettingsChanges()` as written on top of a copy of those settings, which undid both: a subquery with `SETTINGS max_threads = 1000000000, max_threads_min_free_memory_per_thread = 0` made `AggregatingStep` resize the pipeline to 1e9 ports and OOM-killed the server (found by the targeted AST fuzzer on ClickHouse#123125), and a `MAX` or `readonly` constraint on `max_threads` did not bound the aggregation. The re-application came with ClickHouse#114690 for a Fast test failure of 04836 that a later test change fixed; the node context already carries the nested `make_distributed_plan`, so the values are taken from it as they are. The only thing the raw clause still contributed is the `changed` flag of a nested `group_by_overflow_mode` whose value equals the inherited one: `SettingsConstraints::checkOrClamp` drops such a change, and `getTrivialGroupByLimit` reads the flag to keep a user's explicit `throw`. So that flag is set when the node's clause names the setting; nothing else on this path reads a `changed` flag. Test: the nested `max_threads` still reaches the aggregation, a clause dropped under `readonly` no longer does (fails without the fix), and an explicit nested `group_by_overflow_mode = 'throw'` equal to the default still throws (fails without the flag). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #110936
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Description
The AST fuzzer runs the test corpus in one session, so
SET max_streams_to_max_threads_ratio = 288230376151711744in04842_merge_num_streams_marks_overflowstayed in effect for every later query. Under it the server-side fuzzer turnednumbers_mt(1048576)intonumbers_mt(9223372036854775807), and the server was OOM-killed while building one source per block. Failing master job: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=6b601838b5c7526a500254219a92542f852d5e55&name_0=MasterCI&name_1=AST%20fuzzer%20%28amd_release%2C%20oracle%29The ratio is now passed in the
SETTINGSclause of the four queries that need it; 04842 was the only test that set it for the whole session. Both fuzzers keep a query'sSETTINGSin its fuzzed copies, so these queries setast_fuzzer_runs = 0for the server-side one, like 02920, 03714 and 04141, and the test is now a shell test, because the client-side one reads only.sqlfiles (measured on the old file: 10 server-side and 48 client-side fuzzed queries with the 2^58 ratio, 8 of the latter joiningnumbers_mt). The SQL and the reference are unchanged, and the four queries still run with 2^58 (checked insystem.query_log).Workflow [PR]
Sync PR [sync-upstream/pr/123125]
Version info
26.10.1.1225-master(included in26.10and later)