Skip to content

Bound the AST fuzzer post-fuzz liveness probe and do not fuzz the harness's own queries - #122353

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:ast-fuzzer-bound-post-fuzz-liveness-probe
Sep 26, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:ast-fuzzer-bound-post-fuzz-liveness-probe

Conversation

@groeneai

@groeneai groeneai commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

The AST fuzzer job no longer fuzzes its own liveness probe and bounds it, so a server that stops answering gets the existing hung verdict with its logs instead of a 5-hour job timeout.

Description

After a clean fuzz run, the post-fuzz liveness probe SELECT 1 can wait forever. The job then times out at 18000 s and reports a bare ERROR with no server log. A PR run printed 1 and then nothing for 4h28m; a master run printed nothing for 4h27m. Five such runs in 45 days.

Two causes, both in run-fuzzer.sh:

  1. The probe is itself fuzzed. query-fuzzer-tweaks-users.xml enables the server-side AST fuzzer for default, and the mutated copies run in the query-finish callback, before EndOfStream. The pin was part of Do not run the server-side AST fuzzer on the stress harness's own queries #113248, but that half never reached master.
  2. --receive_timeout does not bound the probe: on timeout the client sends Cancel and then waits for the server with no limit (ClientBase::receiveResult).

The change pins --ast_fuzzer_runs=0 on every harness-owned client call (not on the fuzzer's own client) and runs the two post-fuzz probes under timeout --signal TERM --kill-after=10 60. A probe killed by timeout counts like the client's own timeout, so a server that stops answering gets the existing "treating server as hung" verdict after 12 retries (12 to 14 minutes), with its logs. The pre-fuzz probes are unchanged: the server is fresh there, and the check after attaching gdb waits for it on purpose.

Validation (throwaway scripts): an unpinned SELECT 1 got 25 fuzzed follow-ups over 5 probes, the pinned one 0. Against a server holding a query it never answers, the old probe was still waiting when killed at 90 s, and the new one returned at 60 s. A mock-client run of the loop hangs on the old text and reaches the hung verdict on the new one; every other outcome is unchanged.

One server-side hang the fuzzer produces (reading system.stack_trace twice in one query) is addressed separately in #120216. This builds on #115915, which bounded the probe's handshake.


Workflow [PR]
Sync PR [sync-upstream/pr/122353]

Version info

  • Merged into: 26.10.1.737-master (included in 26.10 and later)

…ness's own queries

After a clean fuzz run (`Fuzzer exit code is 143`), the post-fuzz liveness
probe `clickhouse-client --handshake_timeout_ms=30000 --receive_timeout=5
--query 'SELECT 1'` sometimes never returns. status.tsv is then never
written, praktika kills the job at its 18000 s timeout before any artifact
is uploaded, and the job reports a bare ERROR with no server log. Five such
runs in 45 days: PR ClickHouse#112304 (2026-08-18), PR ClickHouse#98670 (2026-08-19), PR ClickHouse#115530
(2026-08-20), true master 9816d0a `AST fuzzer (amd_release, oracle)`
(2026-09-24) and PR ClickHouse#119237 `AST fuzzer (amd_debug, targeted,
old_compatibility)` (2026-09-25). Only the last one printed the `1`.

Two harness defects make the probe unbounded.

(a) The probe is itself fuzzed on the server. query-fuzzer-tweaks-users.xml
sets ast_fuzzer_runs=5 and ast_fuzzer_any_query=true on the `default`
profile, and no harness-owned client call opted out. The server runs the
mutated copies in a query-finish callback, and TCPHandler calls
io.onFinish() after sending the data and before EndOfStream, so a fuzzed
follow-up that does not finish holds the reply open after the `1` was
printed. The same pin was part of ClickHouse#113248, which was closed as already
integrated, but its run-fuzzer.sh half never reached master. The stress
harness (ClickHouse#114127), the log export (ClickHouse#117996) and tests/clickhouse-test
already pin it.

(b) --receive_timeout does not bound the probe either. On a receive
timeout ClientBase::receiveResult only records TIMEOUT_EXCEEDED and cancels
the query; from then on it polls the connection until the server sends a
packet, with no bound. A server whose connection thread never gets back to
the socket holds the probe forever, which is what the four runs that
printed nothing show.

Pin --ast_fuzzer_runs=0 on every harness-owned client call through one
variable; the fuzzer's own client stays unpinned. Run the two post-fuzz
probes (the restart liveness check and the probe loop) under
`timeout --signal TERM --kill-after=10 60`. A probe killed by timeout
(rc 124, or 137 after the kill) is counted like the client's own
"Timeout exceeded while", so a server that stops answering reaches the
existing "treating server as hung" verdict after 12 retries (about
14 minutes) and the job keeps its logs. 60 s covers the probe's own worst
case (30 s handshake, 5 s receive timeout, the cancel round trip) with room
for a slow sanitizer server. The fallback branch now prints the probe's
exit code instead of the last grep's.

The pre-fuzz probes are not wrapped: the check after attaching gdb waits
for gdb to load debug info on purpose, and the server is fresh there.

One server-side hang the fuzzer produces, a self-deadlock when one query
builds two system.stack_trace sources, is fixed separately in ClickHouse#120216.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect labels Sep 26, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings), plus my own cold review of the same head (2 nits, neither blocking).

# Sev Finding Verdict Evidence / action
1 💡 The NO_AST_FUZZER comment says the fuzzed copies run "before the reply"; they run after the rows are sent and before EndOfStream (TCPHandler calls io.onFinish(), then sendEndOfStream) AGREE Left as is: wording only, no behavior change
2 💡 --ast_fuzzer_runs exists since 26.2, so this script change must not be backported below 26.2 AGREE Informational: the current backport branches are all 26.3 or newer

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-slot-9:20260925-233003

@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Sep 26, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b62e74c]

Summary: ✅


AI Review

Summary

This PR updates ci/jobs/scripts/fuzzer/run-fuzzer.sh so harness-owned client queries opt out of the server-side AST fuzzer and the two post-fuzz liveness probes are externally bounded with timeout. After reviewing the current diff, the surrounding script, the helper log-export path, and the existing PR discussion, I did not find a correctness or regression issue that warrants a new inline review comment.

Missing context / blind spots
  • ⚠️ The full PR workflow was still in progress when I reviewed this change on 2026-09-26; only the early config/style checks had finished, so completed CI results were not available as corroborating evidence.
Final Verdict

✅ No actionable inline findings in the current diff.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 26, 2026
@groeneai
groeneai requested a review from maxknv September 26, 2026 00:06
@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Sep 26, 2026
@alexey-milovidov alexey-milovidov self-assigned this Sep 26, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Sep 26, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 26, 2026
Merged via the queue into ClickHouse:master with commit 9669f8b Sep 26, 2026
176 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect manual approve Manual approve required to run CI pr-ci 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.

3 participants