Repository navigation
Cap select_parser_fuzzer max_parser_backtracks at 10000 - #104922
alexey-milovidov merged 1 commit into
Conversation
Commit b5a006c ("add parameters for select_parser_fuzzer, set default threshoulds lower", May 11 2026) made the per-input parser limits in `select_parser_fuzzer` configurable via `-ignore_remaining_args=1` plus `-max_parser_backtracks=N`. As a side effect it changed the in-source default for `max_parser_backtracks` from `5000` to `DBMS_DEFAULT_MAX_PARSER_BACKTRACKS` (= 1,000,000), i.e. a 200x increase. For sibling `create_parser_fuzzer`, the same author followed up with commit e9453b7 ("tune up create_parser_fuzzer settings") that restored a fuzzer-safe budget by adding [fuzzer_arguments] max_parser_backtracks = 10000 to `tests/fuzz/create_parser_fuzzer.options`. The matching update to `tests/fuzz/select_parser_fuzzer.options` was missed, so `libFuzzer` runs of `select_parser_fuzzer` parse each input with a 1,000,000-step backtrack budget. On pathological inputs (deeply-nested parentheses with mixed function-call / subquery shapes — exactly the pattern of closed issue ClickHouse#92282) the parser spends 20-26s before bailing, which is above the 20s `libFuzzer` timeout. CIDB confirms the regression: day select_parser_fuzzer FAIL/ERROR distinct PRs 2026-04-19 1 1 (PR ClickHouse#99740, author's branch) ... 2026-05-11 1 1 (PR ClickHouse#99740) 2026-05-13 24 24 (24 unrelated PRs) 2026-05-14 13 13 (13 unrelated PRs) The spike on 2026-05-13 starts exactly the first day master PRs picked up commit b5a006c. Every recent failure is a `timeout-*` artefact of the form `timeout after 20-26 seconds`, matching issue ClickHouse#92282. The fix is the minimum config change to restore the previously known- good per-input backtrack budget for `select_parser_fuzzer`, mirroring the `create_parser_fuzzer.options` fix. Local mechanism reproduction (clickhouse-local, debug build): SELECT te(((...((SELECT tuple(... (~470 bytes, malformed) --max_parser_depth=300 --max_parser_backtracks=10000 -> 0.16s (TOO_SLOW_PARSING) --max_parser_depth=300 --max_parser_backtracks=1000000 -> 0.92s (~6x slower for the same input) Pre-PR validation gate: - Deterministic repro: yes (see above). - Root cause explained: yes (regression date matches commit b5a006c). - Fix matches root cause: yes (restore 10k backtrack budget that was intentionally set in PR ClickHouse#92325 to fix the timeout class in ClickHouse#92282). - Test intent preserved: yes — fuzzer still exercises the SELECT parser with the same depth (300/150), AST element / depth limits, and corpus. Only the per-input backtrack budget changes. - Both directions demonstrated: yes — local clickhouse-local repro shows the 6x time difference; CIDB shows the regression spike exactly aligned with the commit. Refs: - Tracker issue ClickHouse#93438 ("libFuzzer tests are flaky"). - Originating closed issue ClickHouse#92282 (`select_parser_fuzzer` timeout on deeply nested parens). - Sibling fix: commit e9453b7 (`create_parser_fuzzer.options`). - Regression: commit b5a006c (`select_parser_fuzzer.cpp`). Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
cc @yakov-olkhovskiy @alexey-milovidov — could you review this? CI-only |
|
Workflow [PR], commit [4dd814a] Summary: ✅ AI ReviewSummaryThis PR adds a missing Final VerdictStatus: ✅ Approve |
The `tests/fuzz/select_parser_fuzzer.options` had `timeout = 20`, the per-input libFuzzer wall-clock budget. Combined with the `max_parser_backtracks = 10000` cap from PR ClickHouse#104922, this is fine on release builds (the parser bails in ~0.16s on pathological deeply-nested SELECT inputs) but not on ASan ARM CI runners: those exec at ~18-42/s, so the parser needs >20s of wall time to hit the backtrack cap and abort with `TOO_SLOW_PARSING`. libFuzzer kills the process first and reports `timeout-*` artefacts. Recent CIDB (test_name='select_parser_fuzzer', last 7 days) shows the fuzzer failing on many unrelated PRs every day with timeouts of 20-29s, matching this exact pattern. Example artefact from PR ClickHouse#96130: https://s3.amazonaws.com/clickhouse-test-reports/PRs/96130/8e0106f5809257b068a61a001f58042689b005ab/libfuzzer_tests/select_parser_fuzzer/timeout-49fccbae556e7a03ed5e64d5c08cb55653bb10ce (524-byte malformed SELECT with deeply nested parens and WITH/SELECT chains; reproduces the timeout class from closed issue ClickHouse#92282.) Raising the per-input timeout to 60s gives the backtrack cap room to fire on slow sanitizer/cross-arch runners while keeping a hard ceiling. The cap, not the timeout, is what bounds real worst-case parse work; the timeout just needs to outlive it. Refs: - Open issue ClickHouse#93438 ("libFuzzer tests are flaky"). - Closed issue ClickHouse#92282 (`select_parser_fuzzer` timeout on deeply nested parens) — same input class still surfacing on ASan ARM. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…c OOMs `create_parser_fuzzer` has been failing chronically with `libFuzzer out-of-memory` for weeks, with the actual usage sitting just above the hardcoded 6144 Mb limit. CIDB shows 55 OOM hits across 49 unrelated PRs in the last 30 days (peaking at 17 hits / 17 PRs on 2026-05-17 alone). The reported `used:` values cluster around 6221-7329 Mb (avg 6554 Mb, p95 7329 Mb, max 8830 Mb). 54 of 55 observed OOMs (98%) fall under 8192 Mb. The 6144 limit is essentially at the typical working-set mean for this fuzzer, so any input that triggers even moderate extra allocations during parsing trips the limit. Bump `rss_limit_mb` from 6144 to 8192 to match the chronic working set, following the same precedent as PR ClickHouse#105134 which bumped `clickhouse_fuzzer` from 2048 to 4096 for the same class of "just-barely-over-the-limit" chronic OOMs. The limit is still active (8 GB is not unlimited), so genuine large memory regressions above 8 GB will still be caught. Sibling change: PR ClickHouse#104922 (merged) bumped `select_parser_fuzzer` via `max_parser_backtracks`. This PR addresses the parallel `create_parser_fuzzer` family.
Description / motivation
Cap
select_parser_fuzzer's per-inputmax_parser_backtracksbudget at10000via the
.optionsfile. This is a CI-only configuration fix; no source codeis changed.
Regression source. Commit
b5a006c49a7("add parameters for
select_parser_fuzzer, set default threshoulds lower",2026-05-11) made the per-input limits configurable via
-ignore_remaining_args=1 -max_parser_backtracks=N. As a side effect, thein-source default for
max_parser_backtrackswent from5000toDBMS_DEFAULT_MAX_PARSER_BACKTRACKS(1000000) — a 200x increase.For the sibling
create_parser_fuzzer, the same author added the matching.optionsentry in commite9453b722ae("tune up
create_parser_fuzzersettings") so thatlibFuzzerruns witha fuzzer-safe 10000-step budget. The matching update to
tests/fuzz/select_parser_fuzzer.optionswas missed, so since 2026-05-11 everyPR running the libFuzzer check has been parsing each
select_parser_fuzzercorpus input with a 1,000,000-step budget. On pathological inputs (deeply
nested parentheses with mixed function-call / subquery shapes — exactly the
pattern of closed issue #92282) the parser spends 20-26s before bailing,
which is above the 20s libFuzzer
timeout.CIDB evidence.
select_parser_fuzzerFAIL/ERROR rows in the last 30 days:The 2026-05-13 spike is exactly the first master day after commit
b5a006c49a7was merged. Every recent failure is atimeout-*artefact ofthe form
libFuzzer\ttimeout after 20-26 seconds, matching the symptom inissue #92282.
Local mechanism reproduction (
clickhouse local, debug build, sameinput):
Real
select_parser_fuzzercorpus inputs are larger and amplify this ratioto the 20-26s timeouts observed in CI.
Pre-PR validation gate.
clickhouse localshows a 6x parse-timeratio on the same input as
max_parser_backtracksgoes from10000to1000000.b5a006c49a7exactly; the.optionsoverride that was added forcreate_parser_fuzzerwas missed forselect_parser_fuzzer.budget previously set in PR Fuzzers: select_parser_fuzzer - change max_parser_backtracks to 10.000 (was 1.000.000) #92325 to fix the timeout class in
select_parser_fuzzertimes out when parsing deeply nested parentheses #92282.element / depth limits, same corpus and dictionary. Only the per-input
backtrack budget changes.
10000-vs-1000000 time difference; CIDB shows the regression spike
aligned with the commit.
Refs:
select_parser_fuzzertimes out when parsing deeply nested parentheses #92282 (select_parser_fuzzertimes out whenparsing deeply nested parentheses)
.optionsfix already on master: commite9453b722aeb5a006c49a7Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required (CI-only fix).
Documentation entry for user-facing changes
Version info
26.5.1.645