Skip to content

Fuzzers: select_parser_fuzzer - change max_parser_backtracks to 10.000 (was 1.000.000) - #92325

Merged
alexey-milovidov merged 1 commit into
masterfrom
maintain-fuzzers-backtrack
Dec 17, 2025
Merged

alexey-milovidov merged 1 commit into
masterfrom
maintain-fuzzers-backtrack

Conversation

@yakov-olkhovskiy

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

closes #92282

@clickhouse-gh

clickhouse-gh Bot commented Dec 17, 2025 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [bc1bc67]

Summary: ⏳

job_name test_name status info comment
BuzzHouse (amd_debug) failure
Logical error: 'Inconsistent AST formatting: the query: (STID: 1941-1bfa) FAIL cidb
BuzzHouse (amd_msan) failure
Logical error: Invalid number of columns in chunk pushed to OutputPort. Expected A, found B (STID: 2270-38be) FAIL cidb

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Dec 17, 2025
@yakov-olkhovskiy yakov-olkhovskiy changed the title Fuzzers: change max_parser_backtracks to 10.000 (was 1.000.000) Fuzzers: select_parser_fuzzer - change max_parser_backtracks to 10.000 (was 1.000.000) Dec 17, 2025
@alexey-milovidov alexey-milovidov self-assigned this Dec 17, 2025
@rienath

rienath commented Dec 17, 2025

Copy link
Copy Markdown
Member

Nice, this makes select_parser_fuzzer green!

@alexey-milovidov
alexey-milovidov merged commit 238b317 into master Dec 17, 2025
@alexey-milovidov
alexey-milovidov deleted the maintain-fuzzers-backtrack branch December 17, 2025 17:08
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Dec 17, 2025
pull Bot pushed a commit to mikeyhodl/ClickHouse that referenced this pull request May 14, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

select_parser_fuzzer times out when parsing deeply nested parentheses

4 participants