Skip to content

Do not hide a sanitizer report behind the AST fuzzer "Client failure" verdict - #112047

Closed
groeneai wants to merge 4 commits into
ClickHouse:masterfrom
groeneai:plan/ast-fuzzer-msan-client-failure
Closed

groeneai wants to merge 4 commits into
ClickHouse:masterfrom
groeneai:plan/ast-fuzzer-msan-client-failure

Conversation

@groeneai

Copy link
Copy Markdown
Collaborator

Related: #111725
Related: #111934

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):

...

Description

An AST fuzzer (*) run on a sanitizer build can be killed by a sanitizer report and
still be reported as an opaque Client failure (see logs) with the finding never
named, so the CIDB row carries an empty test_name and the failure is unsearchable.

ci/jobs/scripts/fuzzer/run-fuzzer.sh arms every runtime with
*SAN_OPTIONS=log_path=/workspace/sanitizer.log, so each reporting process writes its
own sanitizer.log.<pid>, and an EXIT trap merges them all into stderr.log and
server.log. When the report kills the CLIENT the server is untouched, so
status.tsv is 0 0 134 and run_fuzz_job lands in the catch-all else: it appends
Client failure (see logs) plus a fuzzer.log tail. Two things then go wrong:
fuzzer.log contains no sanitizer text at all, so that paste holds none of it; and the
naming code is gated behind if is_failed and status != Result.Status.ERROR, which is
false on exactly this branch, so FuzzerLogParser never runs even though its
SANITIZER_ERROR_PATTERN matches the report sitting in stderr.log.

Concretely, AST fuzzer (amd_msan) on #111194
(report,
sha c35d59bfd914045a9d79d0cb692e96695b8215ad) uploaded a 5422-byte
sanitizer.log.914 holding

==914==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 DB::decideParensEmission(...) src/Parsers/IAST.cpp:387:9
    #2 DB::ASTExecuteAsQuery::formatQueryImpl(...) src/Parsers/Access/ASTExecuteAsQuery.cpp:38:19
  Uninitialized value was created by a heap deallocation
    #4 DB::QueryFuzzer::fuzz(ASTPtr &) src/Common/QueryFuzzer.cpp:6182:21
SUMMARY: MemorySanitizer: use-of-uninitialized-value src/Parsers/IAST.cpp:387:9 in DB::decideParensEmission(...)

("created by a heap deallocation" is MSan's wording for a use-after-free; that bug
itself is ASTExecuteAsQuery's raw non-owning members, fixed separately by #111725).
The job reported only Client failure. Over the last 60 days CIDB has 22 such
Client failure rows on sanitizer builds - arm_asan_ubsan 11, amd_msan 6,
amd_tsan 5 - each of which may have hidden a report the same way.

The fix parses every sanitizer.log.* once, before the exit-code logic, and lets the
result force a red verdict in every branch and become a named sub-result. The details
that decide whether it is correct:

  • Every file is parsed, never only the newest or the first, and the merged log is
    not used for selection: distinct processes report independently and the runner
    concatenates them in glob order, so a benign or fatal-OOM record must not shadow or
    outrank a real finding.
  • Benign-ness is read off the raw diagnostic the parser selected - not off the file
    and not off the name. Not the file, because the recoverable warning
    (WARNING: MemorySanitizer failed to allocate 0x... bytes, no colon after the tool
    name) does not abort the process, so the runtime keeps appending and one file can hold
    a benign record followed by a real one. Not the name, because the parser normalizes it
    to MemorySanitizer (STID: ...), dropping failed to allocate, so a name test would
    promote every benign report to a finding.
  • The report path is the parser's only input, so no pattern can reach the real
    server.log and name the normal shutdown's Received signal 15.
  • The veto also covers the benign (0, 137, 143) exit codes. *SAN_OPTIONS is a
    plain export inherited by the server and by the ignored client probes, while
    fuzzer_exit_code is only wait "$fuzzer_pid", so a runtime can report while the
    fuzzer exits 0 or 143.
  • An ERROR already decided upstream is kept explicitly, because
    Result.create_from derives the status from sub-results when given none and a FAIL
    sub-result would downgrade it; and the catch-all note is keyed on that branch rather
    than on the status, so BuzzHouse's own Found disallowed error code diagnostic
    survives.
  • Stale per-run state is removed before the container starts. praktika reuses
    worktrees and ci/tmp is gitignored, and status.tsv is written only at the very end
    under set -e, so a stale success tuple from the previous run would classify this one.
  • A report that cannot be classified at all fails closed instead of being dropped: it
    may itself be the finding, so it forces the same red verdict, vetoes the same OOM
    leniency, and gets its own named Sanitizer report parse failure sub-result with the
    report attached. Three inputs reach that path and none is synthetic: the parser raises when
    head is missing from PATH, because the pipeline's exit status is head's; a report that
    cannot be READ parses to Unknown error without raising (the container runs as root and the
    reports are chown'd afterwards); and rg alone missing parses to Unknown error too,
    because it is piped into head, which exits 0 for the whole pipeline. The missing tool is
    named in the sub-result, so that row stays diagnosable. A report that is READABLE but holds no recognizable diagnostic is still not
    a finding, which is what keeps this narrow. The merged-log parse below is wrapped the
    same way, because forcing the run failed makes that parse reachable on a branch where it
    previously never ran.
  • The merged-log parse cannot contribute a benign row. It reads the concatenated
    stderr.log and selects whichever record came first, so it can select a benign allocator
    record; appending that produced a FAIL sub-result - hence a CIDB test_name row - for
    something the per-report pass had already classified as benign, and the name-based dedupe
    could not remove it because a benign record normalizes to the bare tool name. The same
    benign predicate now gates that row, scoped to sanitizer records: the shared pattern also
    matches the watchdog's Child process was terminated by signal 9, which no
    sanitizer.log.* holds and which nothing else names, so that row must survive.

A benign allocation report on its own still gets today's lenient verdict.

Blast radius, since this can now redden a branch that used to pass: over three days of
master runs, 21 of 219 currently-green sanitizer fuzzer jobs already write a
sanitizer.log.* - ast_fuzzer_arm_asan_ubsan 7 of 18, buzzhouse_arm_asan_ubsan 14 of
18, and none at all on amd_msan or amd_tsan. In every one of those 21 the report is
the benign ASan doesn't fully support makecontext/swapcontext warning, which carries no
colon after the tool name and so matches neither parser start pattern: running
_sanitizer_findings over that verbatim text yields no findings, as a single record and
doubled. None of those jobs turns red. Two adjacent classes were checked the same way and
also yield nothing: the symbolizer warnings and __asan_handle_no_return, for the same
missing-colon reason, and writable-executable page usage, which is gated on
detect_write_exec (default off, never set here). LeakSanitizer cannot contribute
either, because safeExit runs the leak check itself on ASan builds and three real
arm_asan_ubsan server.log artifacts contain no leak report.

The recoverable-allocation half of the benign pattern is keyed on the wording compiler-rt
actually emits: Report("WARNING: <Tool>Sanitizer failed to allocate 0x%zx bytes") is
reached only when AllocatorMayReturnNull, and ClickHouse always sets
allocator_may_return_null=1, so the fatal exceeds maximum supported size form
(ReportAllocationSizeTooBig) is unreachable in these builds and the filter cannot miss a
recoverable case.

ci/tests/test_ast_fuzzer_client_failure_sanitizer.py drives the real run_fuzz_job
against a seeded workspace (only the container run, the docker image, the ownership
repair, the core collection and the host dmesg read are stubbed). 31 of its 41 assertions fail on master and
all pass here; the 10 that pass on master encode existing behavior, which the change must
not alter. Each fix clause was mutation-tested - reverting it alone makes a specific
named test fail, 9 clauses, 9 detected.

The cleanup helper is deliberately byte-compatible with the one in #111934 (the
_clean_stale_run_state and _preseeded_state_is_input bodies are AST-identical modulo
docstrings, and this PR's _STALE_RUN_STATE is a strict subset of that PR's - it adds two
marker files of its own), so whichever lands first the other collapses the duplicate with
no semantic change. #109590 conflicts in a single line - both branches add
an import to the same block - and I ran the combination rather than assuming it: with that
resolved, both PRs' test files against the merged tree give 59 passing (41 + 18), and the
wider fuzzer/parser suites there give 71 passing. #111934
overlaps textually in 11 hunks of ast_fuzzer_job.py - regions both PRs restructure -
so whoever lands second resolves them; the two test files do not collide.

groeneai and others added 4 commits July 27, 2026 02:43
… verdict

run-fuzzer.sh points every sanitizer runtime at *SAN_OPTIONS=log_path, so a
reporting process writes its own sanitizer.log.<pid> and an EXIT trap merges
them all into stderr.log/server.log. A report that kills the CLIENT leaves the
server alive, so status.tsv is "0 0 134" and run_fuzz_job lands in the catch-all
branch: it reported "Client failure (see logs)" plus a fuzzer.log tail and never
named the finding. fuzzer.log holds no sanitizer text at all, so that paste was
empty of it, and the parser that can name the report was gated behind
`status != Result.Status.ERROR`, i.e. skipped on exactly that branch. The CIDB
row's test_name stayed empty, which makes such a run unsearchable and read as
benign.

That is not hypothetical: AST fuzzer (amd_msan) on PR ClickHouse#111194
(c35d59b) uploaded a 5422-byte
sanitizer.log.914 holding a MemorySanitizer use-of-uninitialized-value whose
origin chain reads "created by a heap deallocation" (a use-after-free, fixed
separately by ClickHouse#111725), and the job reported only "Client failure". CIDB has 22
such rows on sanitizer builds over 60 days (arm_asan_ubsan 11, amd_msan 6,
amd_tsan 5).

Parse every sanitizer.log.* once, before the exit-code logic, and let the result
force a red verdict in every branch and become a named sub-result. Details worth
recording:

- Every file is parsed, never just the newest or the first, and the merged log
  is not used for selection: distinct processes report independently and the
  runner concatenates them in glob order, so a benign or fatal-OOM record must
  not shadow or outrank a real finding.
- Benign-ness is decided on the raw diagnostic FuzzerLogParser selected, not on
  the file (a recoverable "failed to allocate" warning does not abort, so one
  file can hold a benign record followed by a real one) and not on the
  normalized name (which drops "failed to allocate", so a name test would
  promote every benign report).
- The report path is the parser's only input, so no pattern can reach the real
  server.log and name the normal shutdown's "Received signal 15".
- The veto reaches the benign (0, 137, 143) exit codes too: *SAN_OPTIONS is
  inherited by the server and by ignored client probes, while fuzzer_exit_code
  is only `wait "$fuzzer_pid"`.
- ERROR is kept explicitly where it was already decided, because
  Result.create_from derives the status from sub-results and a FAIL sub-result
  would downgrade it; the catch-all note is keyed on that branch rather than on
  the status so BuzzHouse's own diagnostic survives.
- Stale per-run state is removed before the container starts. praktika reuses
  worktrees and ci/tmp is gitignored, and status.tsv is written only at the very
  end under `set -e`, so a stale success tuple would classify the next run.

The regression tests drive the real run_fuzz_job against a seeded workspace; 22
of them fail on master. Each fix clause was mutation-tested: reverting it alone
makes a specific named test fail (12/12).
…benign one

Two gaps in the sanitizer-report classification added by the previous commit,
both of which could still lose or invent a fuzzer signal.

The per-report pass swallowed every parser exception and dropped every report
that yielded no usable diagnostic. Measured, two distinct inputs reach those
paths: a missing `rg` or `head` on PATH surfaces as a non-zero exit code and
raises, while a report that cannot be READ returns `Unknown error` without
raising. Either one left `sanitizer_findings` empty, so a run whose fuzzer
exited 0, 137 or 143 stayed OK with an unexamined report on disk - the very
hidden-report outcome this classification exists to prevent, recreated by its
own error handling. An unreadable report is a plausible state rather than a
synthetic one: the container runs as root and the reports are chown'd
afterwards. Such reports are now collected and reported as one named
`Sanitizer report parse failure` sub-result, which forces the run failed (so
the logs and the report are uploaded), promotes an OK verdict to FAIL, and
vetoes the sanitized-build OOM leniency for the same reason a real finding
does. The merged-log parse can raise for the same reasons and is now caught
too, because forcing the run failed made that parse reachable on a branch
where it previously never ran. `ci/jobs/stress_job.py` already fails closed
the same way.

The merged-log parse selects whichever sanitizer record the runner
concatenated first, and a fatal out-of-memory record is a legitimate first.
Its result was appended without the benign test the per-report pass applies,
so a run holding both a fatal allocator record and a real finding emitted a
FAIL sub-result - hence a CIDB `test_name` row - for the benign one. The
name-based dedupe could not remove it because a benign record normalizes to
the bare tool name. The same predicate now gates that row, scoped to
sanitizer records: the shared pattern also matches the watchdog's
"terminated by signal 9", which no sanitizer report holds and which the
per-report pass therefore cannot name, so that row must survive.

Comments and docstrings spell function names without application parentheses,
per `.claude/CLAUDE.md`.
The non-sanitized branch of the classification reads the host's kernel ring
buffer, which is not an input to these tests: on a host that has seen an OOM
kill the real dmesg flips the verdict to ERROR and suppresses the merged-log
parse the signal-9 test exists to exercise. Seed an empty dmesg.log from the
fixture instead, leave the grep over it real so the branch logic stays under
test, and assert both shell-outs happened.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
`FuzzerLogParser.parse_failure` runs `rg ... | head -n10` without pipefail, and
`Shell.get_output` only checks the pipeline's final exit status, so with `rg`
absent the pipeline still succeeds with empty output and the parser returns
`Unknown error` without raising. A readable, real sanitizer report then looked
indistinguishable from one holding no recognizable diagnostic, so it was recorded
neither as a finding nor as a parse failure and a run whose fuzzer exited 0, 137
or 143 stayed green with the report on disk. Classify an unrecognized result as a
parse failure when a tool the parser shells out to is missing, naming the tool so
the resulting row is diagnosable. A readable report holding no recognizable
diagnostic is still not a finding.

The three cases covering the fail-closed path were guarded by a
`skipif(os.geteuid() == 0)` because they used `chmod 000`, and the `CI Tests` job
runs as root, where permissions are not enforced, so that behavior shipped with
no coverage on the only job that runs the file. Drive the production readability
predicate instead of the permission bits and drop both markers: the file now
reports 41 passed with 0 skipped as root as well as unprivileged.
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (4 rounds, 0 blockers outstanding) - click to expand

Before opening this I ran my own cold code review plus an independent second-model
review pass on every round, and adjudicated each finding against the code. Over four
review rounds: 6 AGREE, 2 DISAGREE, 0 outstanding. Round 4 (this head) found no
blocker and no major.

❌ Blockers found and fixed during review

  • A sanitizer report could still be silently dropped when rg alone was missing
    from PATH.
    FuzzerLogParser runs rg ... | head -n10 with no pipefail, and
    Shell.get_output checks only the pipeline's final status, so a missing rg is
    masked by head exiting 0: a real report parses to Unknown error without
    raising
    and read as merely unrecognizable. Measured over the real
    sanitizer.log.914: full PATH names the finding, rg hidden gave no finding and
    no parse failure. Now classified as a parse failure with the missing tool named. I
    deliberately did not add pipefail: a truncated | head -n10 pipeline exits 141
    (SIGPIPE) and the parser uses strict=True, so that would raise on every large
    real report and would also affect stress_job.py.
  • The fail-closed path had no coverage on the job that runs it. Its only three
    cases used chmod 000 behind skipif(os.geteuid() == 0), and the CI Tests job
    runs as root. Measured at the same commit: uid 1000 40 passed, root
    37 passed, 3 skipped. The cases now drive the production readability predicate
    instead of permission bits, and the root run reports 0 skipped.
  • A benign record could produce a false CIDB row. The merged-log parse selects
    whichever record the runner concatenated first, so with a fatal OOM report ordered
    before a real one the job emitted two FAIL sub-results, and the name-based dedupe
    could not drop the benign one (it normalizes to the bare tool name). The same
    benign predicate now gates that row.

⚠️ Majors found and fixed during review

  • One test depended on the host's kernel ring buffer. The only case with a
    non-sanitized check_name reached the production dmesg read; with a stub dmesg
    reporting an OOM kill it failed, because the verdict became ERROR and the parse
    under test never ran. The fixture now seeds an empty dmesg.log for that one
    command, leaves the grep real, and asserts both shell-outs happened.
  • The verdict change needed a measured blast radius. Over three days of master
    runs, 21 of 219 currently-green sanitizer fuzzer jobs already write a
    sanitizer.log.*. All 21 carry the benign
    ASan doesn't fully support makecontext/swapcontext warning, which matches neither
    parser start pattern; running the classifier over that verbatim text yields no
    finding and no parse failure, single, doubled and across two files. None of them
    turns red. That measurement is in the description.

✅ Findings I disagreed with, with evidence

  • black formatting. ci/jobs/check_style.py runs ruff only, origin/master's
    own copy of this file is already not black-clean, and the hunks black wants are
    pre-existing and untouched by this change.
  • A claim that a fail-open path remained after the readability fix, via an
    unreadable-file exemplar.
    Measured which inputs actually reach it: a report that
    cannot be read does not raise, binary content does not raise, and no match does not
    raise. The genuine remaining door was rg alone missing, which is the blocker
    above; the exemplar as given was not the mechanism.

💡 Noted, not blocking

Three prose accuracy points in the test file, none affecting behaviour: a helper
docstring describes the seeded report body as empty when it is deliberately
non-empty (a zero-byte report is never attached, because the upload filter skips
empty files); a fixture hook left without callers after the permission-based cases
were replaced; and one comment saying the parser raises when both rg and head are
missing, where measurement shows raising is governed by head alone (rg absent
exits 0, head absent exits 127). The corrected wording is in the description.

Session id: cron:clickhouse-review-slot-53:20260727-083400

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate
# Check Answer
a Deterministic repro? Yes. Seed a workspace from the real artifacts of the failing run (sanitizer.log.914, stderr.log, server.log, status.tsv = 0\t0\t134) and run the classification: on master the verdict is Client failure (see logs) with zero sub-results; here it is MemorySanitizer: use-of-uninitialized-value (STID: 2312-2e30) with the report attached. pytest ci/tests/test_ast_fuzzer_client_failure_sanitizer.py reproduces it without any artifact download. No C++ build is involved.
b Root cause explained? Yes. run-fuzzer.sh arms every runtime with *SAN_OPTIONS=log_path, so a report goes to sanitizer.log.<pid> and an EXIT trap merges it into stderr.log/server.log. A report that kills the client leaves the server alive, so status.tsv is 0 0 134 and run_fuzz_job takes the catch-all else: status = ERROR plus a fuzzer.log tail. fuzzer.log holds no sanitizer text, and the naming code is gated behind status != Result.Status.ERROR, so FuzzerLogParser never runs although its SANITIZER_ERROR_PATTERN matches the report in stderr.log. Result: the finding is never named and the CIDB test_name is empty.
c Fix matches root cause? Yes. The report is parsed and named where the runner guarantees it exists, and the verdict is derived from that. No widened bound, no no-random-* tag, no size reduction, and no defensive check at a crash site: the classifier that owns the verdict is the thing corrected.
d Test intent preserved / new tests added? Yes. No existing assertion was weakened. test_e2e.py keeps its pre-seeded fuzzer fixture, now marked as job input with an env flag whose removal makes that fixture fail (verified). 41 new assertions were added, 10 of which encode existing behavior and must keep passing on master. None of them skips as root, which matters because the CI Tests job that runs this file runs as root: the fail-closed cases drive the production readability predicate rather than permission bits, which root ignores. A report that is READABLE but holds no recognizable diagnostic is still not a finding - that boundary is what keeps the new fail-closed behavior narrow. The one test that exercises the non-sanitized branch reaches the production dmesg read, so the fixture seeds an empty dmesg.log for it - the host's OOM history is not an input to the test, while the grep over that file still runs for real and the test asserts both shell-outs happened.
e Demonstrated in BOTH directions? Yes. Against pristine origin/master with the same test file: 31 failed, 10 passed. With the fix: 41 passed, as root as well as unprivileged (0 skipped both ways). End-to-end on the real artifacts (sanitizer.log.914, status.tsv = 0 0 134): master reports ERROR with zero sub-results, the fix reports ERROR plus MemorySanitizer: use-of-uninitialized-value (STID: 2312-2e30) with the report attached.
f Fix is general across CODE paths? Yes. _sanitizer_findings is computed once and consulted in every branch: the catch-all client failure, the benign (0, 137, 143) exits, the BuzzHouse 227 branch, the server_died branch, the sanitized-build OOM leniency, and the status.tsv early return. run_fuzz_job is the single entry point for AST fuzzer (*) and BuzzHouse (*) (buzzhouse_job.py imports it), so both are covered. stress_job.py also uses FuzzerLogParser but has no log_path sanitizer reports and no equivalent skip gate, so it is not a carrier.
g Fix generalizes across INPUTS? Yes. Parametrized over all four runtimes (MSan, ASan, TSan, headerless UBSan, the last named generically because its output carries no tool name), over exit codes 0 / 137 / 143 / 134 / 227 / server_died, and over boundary reports: empty, garbage bytes, truncated mid-header, truncated-benign, benign-then-real in one file, glued ASan-benign plus headerless UBSan, multiple files with the benign one newer, and a fatal OOM record ordered before a real finding.
h Backward compatible? Yes, and not applicable in the settings sense: CI harness only, no setting, no serialization format, no SettingsChangesHistory.cpp. A run with no sanitizer.log.* evaluates every predicate exactly as before, so non-sanitizer builds are unaffected. SANITIZER_OOM_PATTERN is byte-identical to the literal it replaces, verified behaviourally identical through the same rg invocation.
i Invariants and contracts preserved? Yes. A benign allocation report alone still gets the lenient OK. An ERROR decided upstream stays ERROR (Result.create_from would otherwise derive FAIL from a sub-result). The catch-all note is keyed on that branch, not on the status, so BuzzHouse's Found disallowed error code info is not clobbered. info[0] is never rewritten. Findings are deduplicated by name so one finding is never reported twice. A report that cannot be classified at all is reported as its own named Sanitizer report parse failure sub-result rather than silently dropped, and one malformed report still does not abort the job. All three ways that happens close: the parser raising, a report that cannot be read, and a tool the parser shells out to being absent from PATH (the parser pipes rg into head without pipefail, so a missing rg otherwise returns Unknown error without raising and reads as a merely unrecognizable report); the missing tool is named so the row is diagnosable. The merged-log benign filter is scoped to sanitizer records, so the watchdog's terminated by signal 9 - which matches the same pattern but is held by no sanitizer.log.* and so cannot be named by the per-report pass - keeps its row. The pre-launch cleanup fails closed and does not touch the pre-container inputs (fuzz.json, ci-targeted-queries.txt, ci-changed-files.txt), asserted in the tests.

Verification: 41/41 new tests pass, 31 of them fail on origin/master, and the file reports
0 skipped as root as well as unprivileged. 50 consecutive
runs of the new file: 41 passed every time, no flakiness, and the file also passes
with a stub dmesg on PATH that reports an OOM kill (on the previous revision that
environment made one test fail). 9/9 mutations detected (reverting any single fix clause
makes a specific named test fail; deleting the readability check fails the three
fail-closed cases as root too), plus 2/2 on the fixture's dmesg interception
(removing it, or widening it to swallow the grep as well, each makes that test fail). Neighbouring suites
green: test_e2e.py + test_log_parser.py + test_fuzzer_liveness_loop.py +
test_result.py 39 passed. ruff clean. Blast radius re-measured after the change: the
benign ASan doesn't fully support makecontext/swapcontext warning that 21 of 219
currently-green sanitizer fuzzer jobs already write yields 0 findings and 0 parse
failures (probed single, doubled, and split across two files), so none of those jobs
turns red. Both in-flight PRs on this file are ours; this round adds no new symbol
collision with either (every symbol it introduces is absent from #111934), and the
ordering composes - #111934's artifact-readability rescue runs before this
classification.

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @leshikus - could you review this? An AST fuzzer (*) run on a sanitizer build could be killed by a real sanitizer report and still be reported as an opaque Client failure (see logs) with an empty CIDB test_name, because the naming code is gated behind status != Result.Status.ERROR (false on exactly that branch) and the pasted fuzzer.log tail holds no sanitizer text; every sanitizer.log.* is now parsed before the exit-code logic so a report forces a red verdict in every branch and becomes a named, searchable sub-result. Blast radius is measured in the description: none of the 21 of 219 currently-green sanitizer fuzzer jobs that already write a report turns red.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Jul 27, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b9fdafc]

Summary: ✅


AI Review

Summary

This PR fixes AST fuzzer sanitizer-report classification so raw sanitizer.log.* findings are named even on the client-failure path, stale workspace state is cleared before a new run, and unclassifiable reports fail closed instead of leaving the job green. After checking the current diff, the surrounding code, the prior PR discussion, and the current PR state, I did not find a new correctness or reliability issue in the change as it stands.

Missing context / blind spots
  • ⚠️ pytest is not installed in this environment, so I could not run ci/tests/test_ast_fuzzer_client_failure_sanitizer.py, ci/tests/test_log_parser.py, or ci/tests/test_e2e.py here. I did verify syntax with python3 -m py_compile, exercised run_fuzz_job manually for the main client-failure case, exercised _sanitizer_findings manually for the missing-rg fail-closed path, and the current Praktika PR report for https://github.com/ClickHouse/ClickHouse/pull/112047 shows no failed checks.
Final Verdict

✅ No new findings.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 27, 2026
@PedroTadim PedroTadim self-assigned this Jul 27, 2026
@PedroTadim

Copy link
Copy Markdown
Member

@groeneai this was the real CI failure:

==914==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x555b2c5597fe in DB::decideParensEmission(DB::IAST const&, DB::IAST::FormatStateStacked&) src/Parsers/IAST.cpp:387:9
    #1 0x555b2c5599ea in DB::IAST::format(DB::WriteBuffer&, DB::IAST::FormatSettings const&, DB::IASTFormatState&, DB::IAST::FormatStateStacked) const src/Parsers/IAST.cpp:485:25
    #2 0x555b2c70117f in DB::ASTExecuteAsQuery::formatQueryImpl(DB::WriteBuffer&, DB::IAST::FormatSettings const&, DB::IASTFormatState&, DB::IAST::FormatStateStacked) const src/Parsers/Access/ASTExecuteAsQuery.cpp:38:19
    #3 0x555b2c3da9ee in DB::ASTQueryWithOutput::formatImpl(DB::WriteBuffer&, DB::IAST::FormatSettings const&, DB::IASTFormatState&, DB::IAST::FormatStateStacked) const src/Parsers/ASTQueryWithOutput.cpp:32:5
    #4 0x555b2c556f15 in DB::IAST::format(DB::WriteBuffer&, DB::IAST::FormatSettings const&) const src/Parsers/IAST.cpp:477:5
    #5 0x555b2c556b5c in DB::IAST::formatWithPossiblyHidingSensitiveData(unsigned long, bool, bool, bool, DB::IdentifierQuotingRule, DB::IdentifierQuotingStyle) const src/Parsers/IAST.cpp:211:5
    #6 0x555b2c557221 in DB::IAST::formatWithSecretsOneLine() const src/Parsers/IAST.cpp:239:12
    #7 0x555afb60a2f0 in DB::QueryFuzzer::fuzzMain(boost::intrusive_ptr<DB::IAST>&) src/Common/QueryFuzzer.cpp:7701:29
    #8 0x555afbdb2ca7 in DB::Client::processWithASTFuzzer(std::__1::basic_string_view<char, std::__1::char_traits<char>>) programs/client/FuzzLoop.cpp:259:24
    #9 0x555b261a455a in DB::ClientBase::executeMultiQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) src/Client/ClientBase.cpp:3047:26
    #10 0x555b261aca94 in DB::ClientBase::processMultiQueryFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) src/Client/ClientBase.cpp:4379:12
    #11 0x555b261d5d63 in DB::ClientBase::runNonInteractive() src/Client/ClientBase.cpp:4400:18
    #12 0x555afbd49985 in DB::Client::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) programs/client/Client.cpp:445:9
    #13 0x555b3ad4b57e in Poco::Util::Application::run() base/poco/Util/src/Application.cpp:315:8
    #14 0x555afbd78588 in mainEntryClickHouseClient(int, char**) programs/client/Client.cpp:1392:23
    #15 0x555adfa85a18 in main programs/main.cpp:431:21
    #16 0x7f60c7df9d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #17 0x7f60c7df9e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #18 0x555adf9f19ad in _start (/repo/ci/tmp/clickhouse+0xc8c39ad) (BuildId: 3f8fffc1a094a6330bae0244a75e2907d98bdde6)

  Uninitialized value was created by a heap deallocation
    #0 0x555adfa82369 in operator delete(void*) (/repo/ci/tmp/clickhouse+0xc954369) (BuildId: 3f8fffc1a094a6330bae0244a75e2907d98bdde6)
    #1 0x555b2c551474 in DB::intrusive_ptr_release(DB::IAST const*) src/Parsers/IAST.cpp:71:17
    #2 0x555afb6700f0 in boost::intrusive_ptr<DB::IAST>::~intrusive_ptr() contrib/boost/boost/smart_ptr/intrusive_ptr.hpp:76:23
    #3 0x555afb6700f0 in boost::intrusive_ptr<DB::IAST>::operator=(boost::intrusive_ptr<DB::IAST> const&) contrib/boost/boost/smart_ptr/intrusive_ptr.hpp:116:9
    #4 0x555afb5842f5 in DB::QueryFuzzer::fuzz(boost::intrusive_ptr<DB::IAST>&) src/Common/QueryFuzzer.cpp:6182:21
    #5 0x555afb5ed57e in DB::QueryFuzzer::fuzz(boost::container::vector<boost::intrusive_ptr<DB::IAST>, boost::container::new_allocator<boost::intrusive_ptr<DB::IAST>>, boost::container::vector_opt<void, unsigned int>>&) src/Common/QueryFuzzer.cpp:3652:9
    #6 0x555afb59bd34 in DB::QueryFuzzer::fuzz(boost::intrusive_ptr<DB::IAST>&) src/Common/QueryFuzzer.cpp
    #7 0x555afb60a042 in DB::QueryFuzzer::fuzzMain(boost::intrusive_ptr<DB::IAST>&) src/Common/QueryFuzzer.cpp:7683:5
    #8 0x555afbdb2ca7 in DB::Client::processWithASTFuzzer(std::__1::basic_string_view<char, std::__1::char_traits<char>>) programs/client/FuzzLoop.cpp:259:24
    #9 0x555b261a455a in DB::ClientBase::executeMultiQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) src/Client/ClientBase.cpp:3047:26
    #10 0x555b261aca94 in DB::ClientBase::processMultiQueryFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) src/Client/ClientBase.cpp:4379:12
    #11 0x555b261d5d63 in DB::ClientBase::runNonInteractive() src/Client/ClientBase.cpp:4400:18
    #12 0x555afbd49985 in DB::Client::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) programs/client/Client.cpp:445:9
    #13 0x555b3ad4b57e in Poco::Util::Application::run() base/poco/Util/src/Application.cpp:315:8
    #14 0x555afbd78588 in mainEntryClickHouseClient(int, char**) programs/client/Client.cpp:1392:23
    #15 0x555adfa85a18 in main programs/main.cpp:431:21
    #16 0x7f60c7df9d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

SUMMARY: MemorySanitizer: use-of-uninitialized-value src/Parsers/IAST.cpp:387:9 in DB::decideParensEmission(DB::IAST const&, DB::IAST::FormatStateStacked&)
Exiting

@PedroTadim PedroTadim closed this Jul 28, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Agreed, and that is the report this PR is about: it is the sanitizer.log.914 from AST fuzzer (amd_msan) on #111194 (sha c35d59bf), quoted in the description above.

The C++ bug in it is already fixed. ASTExecuteAsQuery held target_user and subquery as raw non-owning pointers that alias entries of children, so QueryFuzzer::fuzz replacing a child slot in place (QueryFuzzer.cpp:6182, the deallocation frame in your paste) freed the node, and formatQueryImpl (ASTExecuteAsQuery.cpp:38, frame #2) then read it. #111725 made both members owning; it merged on 2026-07-27 at 08:14 UTC (efccb01cfb8d) and is on master.

This PR does not touch that bug. It fixes why the report had to be pasted by hand. When the report kills the client the server is untouched, status.tsv records the server alive with the client exiting 134, and run_fuzz_job lands in the catch-all branch that appends Client failure (see logs) plus a fuzzer.log tail (ci/jobs/ast_fuzzer_job.py:485-488 on master). fuzzer.log holds no sanitizer text at all, and the naming code is gated on is_failed and status != Result.Status.ERROR (:529), which is false on exactly that branch, so FuzzerLogParser never runs and the CIDB row lands with an empty test_name. That is also why my own finish-ledger row on #111194 called this failure benign: I read the log the job pastes instead of sanitizer.log.*. I corrected that row on #111194.

The same opaque verdict shape is on 15 sanitizer AST fuzzer (*) rows across 12 PRs and 3 master runs in the last 14 days, so the gap is not specific to this report (I have not checked each of those rows for a report on disk).

@PedroTadim your call on the harness change: if you would rather not have it, leaving this closed is fine by me. If you want it, reopen this PR, or say so and I will open a fresh one with the same change. I will not reopen it myself.

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 pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants