Skip to content

Fix the CI failure reporter discarding the error message - #112014

Merged
PedroTadim merged 3 commits into
ClickHouse:masterfrom
groeneai:ci/fix-log-parser-drops-error-message
Sep 7, 2026
Merged

PedroTadim merged 3 commits into
ClickHouse:masterfrom
groeneai:ci/fix-log-parser-drops-error-message

Conversation

@groeneai

@groeneai groeneai commented Jul 27, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #111892
Related: #111708
Related: #111873
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

FuzzerLogParser.parse_failure trims the matched log record to "all lines before
the next log line", but the scan started at index 0, i.e. it also tested the
matched line itself. Several error_patterns alternatives are written with a
leading .*, so rg -o keeps the record's own ] {query_id} <Level> prefix; the
next-record guard then fires at index 0, error_lines[:0] is empty and the failure
is reported with an empty Error: section.

This is what the Server unresponsive: memory limit exceeded leaf has been doing.
Its 33 CIDB rows over 90 days span 23 pull requests and 9 master runs, and every
one of them has an empty Error: section - 31 as the byte-identical 57-character
envelope below, the other 2 as the same thing without the Log files: line that
only the stress job prepends:

Log files: clickhouse-server.err.log, stderr.log
Error:

while the job's own clickhouse-server.err.log holds the message, the limit, the
RSS and the allocation site. For master run b0ab0f245a7ce9eb8c32bbb0f68d3c1359dcfac4
(Stress test (arm_release)), the record the parser matched and then dropped is:

2026.07.23 12:49:49.312341 [ 3574 ] {0166dacb-...::201403_1_29_1} <Error> virtual bool
DB::MergePlainMergeTreeTask::executeStep(): Exception is in merge_task.: Code: 241.
DB::Exception: (total) memory limit exceeded: would use 43.50 GiB (attempt to allocate
chunk of 0.00 B), current RSS: 47.10 GiB, maximum: 47.07 GiB. (MEMORY_LIMIT_EXCEEDED)

plus eight frames naming MemoryTracker::allocImpl under
MergeTreeReadTask::createReaders. Driving the real parser over that artifact:
error_output is 0 characters on master and 1911 characters (message + allocation
site, still bounded by the existing head -n10) with this change.

error_patterns has 7 entries holding 12 top-level alternatives. One case per
alternative was driven through the real parser in both directions (the two marked
† follow from the leading-.* structure, sharing an entry with a measured
sibling). Five of the seven entries lose their message this way and are repaired
here; an entry can appear on both sides of the table, e.g. Assertion has one
affected and two unaffected alternatives.

error_patterns entry alternative Error: on master with this change
Memory limit exceeded .*\(total\) memory limit exceeded.* empty message + allocation site
Assertion .*_LIBCPP_ASSERT.* empty message
Signal .*Child process was terminated by signal 9.* empty message
Sanitizer .*[a-zA-Z]+Sanitizer: CHECK failed:.* empty report
Runtime error .*is located.* empty message
Runtime error .*runtime error: .* † empty message
Logical error Logical error.* correct byte-identical
SegFault Segmentation fault.* correct byte-identical
Signal Received signal.* correct byte-identical
Assertion Assertion.*failed correct byte-identical
Assertion Failed assertion.* † correct byte-identical
Sanitizer (SUMMARY|ERROR|WARNING): ...Sanitizer:.* correct byte-identical

The alternatives that were already correct are exactly the ones without a leading
.*: rg -o strips the prefix for them, so their line 0 never satisfied the guard.
The guard itself is right; only its start index was wrong, and a loop looking for
the next log record must not examine the record it started from.

Job status is unaffected: stress_job.py's is_oom override is computed
independently of this parser, so this only restores the content of the leaf.

Five regression tests are added in ci/tests/test_log_parser.py, one per repaired
entry, each asserting the message is present in the Error: section specifically
(the same text can also appear in the separate Stack trace: section, so an
assertion over the whole info would pass even with the message dropped) and that
the capture still stops at the next log record. Reverting the one-line change fails
exactly those five and leaves the three pre-existing tests green.

ci/jobs/scripts/log_parser.py is also touched by #111708, #111873 and #111934, all
on other parts of the file. Each was merged onto this branch: all three merge with
no conflict and the combined ci/tests/test_log_parser.py passes (16, 12 and 8
tests respectively). #111873 re-anchors the signal pattern, which incidentally
removes the leading .* from one of the six alternatives above; the loop bound is
still wrong for the other five, so the two changes are independent and compose in
either merge order.


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

Version info

  • Merged into: 26.9.1.895 (included in 26.9 and later)

`FuzzerLogParser.parse_failure` trims the matched log record to "all lines
before the next log line", but the scan started at index 0 - the matched line
itself. Seven of the `error_patterns` alternatives are written with a leading
`.*`, so `rg -o` keeps the record's own "] {query_id} <Level>" prefix and the
next-record guard fires on index 0, yielding `error_lines[:0] == []`. The
failure was then reported with an empty `Error:` section.

That is what "Server unresponsive: memory limit exceeded" has been doing: all
33 CIDB rows over 90 days carry a byte-identical 57-char envelope
("Log files: ...\nError:\n\n") while the job's own artifact holds the message,
the limit, the RSS and the allocation stack. Four prior investigations of that
signature had to guess a mechanism because the reporter had removed the
evidence.

Measured, one case per `error_patterns` entry: five entries lose their message
this way (memory limit, `_LIBCPP_ASSERT`, the watchdog signal-9 record,
`Sanitizer: CHECK failed:` and the `is located` runtime-error alternative), and
the alternatives without a leading `.*` (`Logical error`, `Segmentation fault`,
`Received signal`, the plain `Assertion` and header-form sanitizer reports) are
byte-identical before and after.

The guard itself is correct; only its start index was wrong. A loop that looks
for the NEXT log record must not examine the record it started from.
@groeneai

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

Two independent reviews of this change before publication: an internal cold review
of the resulting code (no access to the author's own write-up) and a second-model
gate pass. Verdicts below.

Second-model gate pass: 0 findings. Coverage reported: both changed files read
in full, all three parse_failure callers and every error_patterns path, plus the
reverted-change behaviour.

Internal cold review: no blockers, no majors. Independently re-derived the
affected set (7 error_patterns entries / 12 top-level alternatives; the 6 with a
leading .*, over 5 entries, are the affected ones) and confirmed it matches the
change's claim; confirmed grep -rn '"] {" in line' ci/ returns this loop and no
other, so there is no symmetric implementation left unfixed; confirmed
result_name is computed before the loop, so no failure NAME and therefore no CIDB
test_name bucket changes; confirmed the job verdict is untouched because
stress_job.py's is_oom is computed from dmesg.log and its own rg; and
confirmed nothing downstream keys on info content (check_ci.py's content
regexes are Unit-tests-only, and it titles issues from result.name).

Three ⚠️ documentation-accuracy items were found and fixed in the PR text before
publication, all in the description rather than the code:

Finding Verdict
⚠️ The description said all 33 CIDB rows carry a byte-identical 57-character envelope. Re-running the query gives {57: 31, 8: 2}: the two 8-character rows are AST fuzzer leaves, whose caller does not prepend the Log files: line that only the stress job adds. The Error: section is empty in all 33, so the substance held, but a reader re-running the query would get a different number. AGREE, description corrected
⚠️ The per-alternative table listed 10 of the 12 alternatives (.*runtime error: .* and Failed assertion.* were absent) and did not state that it is keyed per alternative, so entries such as Assertion appeared on both sides with no explanation. AGREE, table completed to 12 rows, keying stated, and the two alternatives that were not individually driven through the parser are marked rather than claimed as measured
⚠️ The input-coverage answer did not mention FuzzerLogParser's third input route, stack_trace_str, which feeds the same loop. It is repaired identically by the bound change and has no production caller today, so it is untested by design. AGREE, stated explicitly
Finding Verdict
❌ Whether to rebase onto current master (180 commits ahead of the branch base). DISAGREE with rebasing. Master touched neither changed file in that range (git diff --stat <base>..origin/master -- <both files> is empty), git merge-tree --write-tree origin/master HEAD succeeds with no conflict, and the submodule pin sets are identical. A rebase would invalidate the gated content for no benefit.

Also verified independently: the vacuity trap the tests close is real. Without the
_error_section helper, the sanitizer case passes on an unfixed tree, because
get_sanitizer_stack_trace() re-extracts the same report text into the separate
Stack trace: section of the info, so an assertion over the whole info succeeds
while the Error: section is empty.

Session id: cron:clickhouse-review-slot-9:20260727-041300

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. python3 -m pytest ci/tests/test_log_parser.py -q - pure python, no server, no randomization, 100% deterministic.
b Root cause explained? Yes. An error_patterns alternative written with a leading .* makes rg -o keep the record's own ] {query_id} <Level> prefix; the "keep all lines before next log line" loop started at index 0, so its next-record guard matched the line it started from, error_lines[:0] was empty and the Error: section came out blank. result_name is built at :150 before the loop, so the name survived while the message was destroyed.
c Fix matches root cause? Yes. The loop's own comment states its contract and the code violated it by one index; only the start index changes. Patterns, matching and reporting are untouched. Rejected as band-aids: rewriting the patterns (changes which lines MATCH), stripping the prefix from line 0 (a second prefix-parsing surface that masks the bound bug), special-casing the memory branch (repairs 1 of the 5 affected entries).
d Test intent preserved / new tests added? Yes. The 3 pre-existing tests are unchanged and green; 5 new tests are added, one per repaired error_patterns entry. Each asserts against the Error: section specifically - the same text can also appear in the separate Stack trace: section, so an assertion over the whole info would pass even with the message dropped.
e Both directions demonstrated? Yes. Tests written first: 4 failed / 3 passed on the unfixed tree, every failure on the intended empty-message assertion (assert '(total) memory limit exceeded' in '\n'); 8 passed with the fix. Reverting the one-line change fails exactly the 5 new tests and leaves the 3 pre-existing ones green. On the real 447999-line master artifact the Error: section goes from 0 to 1911 characters (message + allocation site, still bounded by the existing head -n10).
f Fix is general across code paths? Yes. error_patterns has 7 entries holding 12 top-level alternatives; 10 of the 12 were driven through the real parser in both directions (the two not driven, .*runtime error: .* and Failed assertion.*, each share an entry with a driven sibling and follow from the leading-.* structure). 6 alternatives over 5 entries lose their message and are repaired (memory limit, _LIBCPP_ASSERT, watchdog signal 9, Sanitizer: CHECK failed:, and both runtime-error alternatives); the rest are byte-identical before and after. The affected set is exactly the alternatives with a leading .*. FuzzerLogParser is the only failure-naming class, grep -rn '"] {" in line' ci/ returns exactly this one loop, and the class's other extraction site (get_failed_query) has its own rg and no trimming loop.
g Fix generalizes across inputs (params/datatypes/wrappers)? The input is log text; type wrappers are N/A. Covered: prefixed vs unprefixed line 0, the is_check_failed blank-line branch, a following unrelated log record (every new test asserts the capture does not swallow it), single-line input (error_lines[1:] empty, whole line kept), and the route where the server log is passed as both logs (clickhouse_proc.py). The class's third input route, stack_trace_str (:108-112), feeds the same loop and is fixed identically, but has no production caller today (grep -rn stack_trace_str ci/ finds only this file), so it is not exercised by a test.
h Backward compatible? Yes. No setting, no serialization format, no SettingsChangesHistory.cpp. All three consumers put info into a report leaf, so a longer non-empty info is strictly better at each. Job OK/FAIL status is unchanged - stress_job.py's is_oom override is computed independently of this parser.
i Invariants and contracts preserved? Invariant: when a pattern matches, error_output must contain that match. Restored for 6 alternatives, preserved for the other 6. enumerate(error_lines[1:], start=1) keeps i in the original coordinate system so error_lines[:i] still slices correctly. The loop's other branch cannot change: a CHECK-failed report's line 0 is never blank, confirmed by the two pre-existing ASan tests being byte-identical under both variants.

Session id: cron:clickhouse-impl-slot-40:20260727-031000

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @leshikus - could you review this? FuzzerLogParser.parse_failure trimmed its match with a loop that started at index 0, so for any error_patterns alternative written with a leading .* (which makes rg -o keep the record's own ] {query_id} <Level> prefix) the next-record guard fired on the line it started from and the Error: section came out empty; the fix moves the scan start to index 1.

@PedroTadim PedroTadim 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 [eea5393]

Summary: ✅


AI Review

Summary

The PR fixes FuzzerLogParser.parse_failure so the "next log line" scan no longer re-matches the line it started from when a leading .* pattern preserves the ClickHouse log prefix. I traced the current ERROR_PATTERNS behavior through all three parse_failure callers and exercised representative affected and unaffected cases against the live parser; I did not find a correctness, safety, test-evidence, or PR-metadata issue in the current revision.

Final Verdict

✅ No review findings.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 27, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — ecda817

CI is fully finished on this head (praktika Finish Workflow = pass; 25 jobs ran, 147 filtered/cached, 2 red). Neither red is caused by this PR: its whole diff is ci/jobs/scripts/log_parser.py + ci/tests/test_log_parser.py, so it cannot change any src/ code path. Every failure below has an owner.

Check / test Reason Owner / fixing PR
Stress test (arm_debug) / Logical error: Inconsistent KeyCondition behavior (STID: 5182-2f27) pre-existing debug-only monotonicity canary (issue #90461); 30d spread is ~90 hits across ~70 unrelated PRs plus master runs on both Stress test (amd_debug) and (arm_debug) #109023 (ours, open)
AST fuzzer (arm_asan_ubsan) / Logical error: '!predicates.empty()' (STID: 2508-36b9) fuzzer-tool self-abort: QueryFuzzer::permutePredicateClause (src/Common/QueryFuzzer.cpp:3919) asserts a non-empty extraction, but a zero-argument and() (the fuzzed queries carry QUALIFY and()) satisfies the and/or/xor branch with no children, so extractPredicates legitimately returns empty. First public occurrence of this site; 0 master hits so far a fix task is created (investigating at full effort — fixing-PR link to follow on this PR)

Both are debug/sanitizer-build assertions in code this PR does not touch.

Session id: cron:our-pr-ci-monitor:20260727-090000

@groeneai

Copy link
Copy Markdown
Collaborator Author

Discharging the finish-ledger promise for the AST fuzzer (arm_asan_ubsan) failure on
ecda8174cacd8b3ea74e244c0c1231390fcef152:

Check / test Owner / fixing PR
AST fuzzer (arm_asan_ubsan) / Logical error: '!predicates.empty()' (STID: 2508-36b9) #112139 (ours, open)

Correcting the reason column while I am here. The ledger row called it a fuzzer-tool self-abort on a
zero-argument and(), which is right, but understated it in two ways. The abort is not
QUALIFY-specific: permutePredicateClause has four call sites and a degenerate node reaches three
of them directly, so a bare and() anywhere the fuzzer permutes a predicate reproduces it, including
a JOIN ON clause. And the same guard that produced the empty extraction also let a logical node with
a null argument list recurse on itself, an unbounded mutual recursion rather than an assertion
failure. The fix is in the shared flattening callee, so all four call sites are covered by one change.

Deterministic reproducer on an unpatched build, no fuzzing session needed:

SELECT * FROM fuzzQuery('SELECT 1 FROM numbers(10) WHERE and()', 2000, 8) LIMIT 200 FORMAT Null;

This pull request's own diff is two ci/ Python files and cannot reach src/Common/QueryFuzzer.cpp;
it is where the failure was observed, not its cause.

groeneai added a commit to groeneai/ClickHouse that referenced this pull request Jul 27, 2026
Follow-up to the review on ClickHouse#112139.

- `extractPredicates` keeps its original `if (func->name == op && func->arguments)`
  condition; the degenerate-argument-list check is nested inside it rather than
  restructuring the branch order.
- Removed `src/Common/tests/gtest_query_fuzzer_degenerate_predicate.cpp` and the
  friend declarations it needed, so `src/Common/QueryFuzzer.h` is untouched again.
  `04651_fuzzer_degenerate_logical_predicate` is the only test now.

With the outer condition restored, a node whose `arguments` is null no longer reaches
the degenerate branch in `extractPredicates`; it falls through to the call into
`permutePredicateClause`, whose own early return breaks the recursion there. Verified
by removing that early return and driving an `ASTFunction{name = "and", arguments =
nullptr}` through it: stack overflow, SIGSEGV.

All four statements of the stateless test still abort on a pristine master build and
pass here. Removing both guards reproduces master exactly (the mutated file is
byte-identical to master's). 50/50 randomized runs of the new test pass, as do
`03031_table_function_fuzzquery`, `03834_fuzz_query_function`,
`04141_fuzz_query_max_query_length`, `04202_storage_fuzzquery_engine` and the
existing `QueryFuzzer` unit tests.

Related: ClickHouse#112014
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112014&sha=ecda8174cacd8b3ea74e244c0c1231390fcef152&name_0=PR&name_1=AST%20fuzzer%20%28arm_asan_ubsan%29
Manerone pushed a commit to Manerone/ClickHouse that referenced this pull request Jul 28, 2026
Follow-up to the previous commit on this branch, which stopped the AST fuzzer from
aborting on a degenerate logical call such as `and()`. That commit's stateless test
asserts only that `fuzzQuery` returns rows, and `FuzzQuerySource::createColumn` falls
back to emitting the unfuzzed base query, so an inert fuzzer still satisfies it. The
abort oracle it provides does pin the removal of `chassert(!predicates.empty())`, but
neither of the two guards that make the empty extraction impossible was pinned: dropping
the degenerate-leaf `predicates.emplace_back(node)` in `extractPredicates`, or the
degenerate early return in `permutePredicateClause`, left the suite green.

`src/Common/tests/gtest_query_fuzzer_degenerate_predicate.cpp` calls the two private
helpers directly, so each guard has its own assertion and no dependence on the fuzzer's
random draw. `extractPredicates` must contribute exactly one opaque leaf for a degenerate
node, and the same for a logical `ASTFunction` whose `arguments` is null (the shape that
used to recurse on itself); `permutePredicateClause` must return that node unchanged, or
`not` of it, never a fresh logical call wrapping it. Reverting either guard fails exactly
the assertions for that guard and no others; reverting both fails all three. The
gtest fixtures reach the helpers through the in-tree friend-class idiom, as
`LRUFileCachePriority` and `TemporaryDataOnDisk` already do.

The stateless test loses its `no-llvm-coverage` tag. Its rationale was that `fuzzQuery`
drives the process-global `QueryFuzzer` whose accumulated state varies run-to-run, which
is true of the scalar `fuzzQuery` function and of `03834_fuzz_query_function`, but not of
the table function used here: `FuzzQuerySource` owns a per-source `QueryFuzzer` seeded
from its `random_seed` argument, and `getGlobalASTFuzzer` has no caller under
`src/Storages` or `src/TableFunctions`. The output is byte-identical across repeated runs
and across an intervening load of 500 global-fuzzer calls, so there is nothing
non-deterministic to skip. `04141_fuzz_query_max_query_length` is the same-form
precedent and carries `no-fasttest` only. The remaining `no-fasttest` is load-bearing for
a different reason, now stated in the test: fast builds are `NDEBUG` without sanitizers,
so `chassert` expands to `(void)sizeof(...)` and the statements would pass vacuously.

The comment on the new `extractPredicates` branch said extraction from a degenerate node
"yields nothing" three lines above the code that appends a leaf. It now says the call
contributes exactly one opaque leaf, which is the reason the extraction can no longer
come back empty.

The previous commit message described the test as covering every caller of
`permutePredicateClause` a degenerate node can reach. That is not right: there are four
call sites, the test drives a degenerate node through three of them, and the fourth,
`fuzzMandatoryPredicate`, is covered by construction because the fix is in the shared
callee.

The failure was observed on an unrelated pull request, ClickHouse#112014, whose diff is two `ci/`
Python files. It is linked below as the source of the CI report only, not as the cause.

Related: ClickHouse#112014
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112014&sha=ecda8174cacd8b3ea74e244c0c1231390fcef152&name_0=PR&name_1=AST%20fuzzer%20%28arm_asan_ubsan%29

Co-Authored-By: Claude Opus 5 <[email protected]>
scanhex12 pushed a commit to scanhex12/ClickHouse that referenced this pull request Jul 29, 2026
Follow-up to the previous commit on this branch, which stopped the AST fuzzer from
aborting on a degenerate logical call such as `and()`. That commit's stateless test
asserts only that `fuzzQuery` returns rows, and `FuzzQuerySource::createColumn` falls
back to emitting the unfuzzed base query, so an inert fuzzer still satisfies it. The
abort oracle it provides does pin the removal of `chassert(!predicates.empty())`, but
neither of the two guards that make the empty extraction impossible was pinned: dropping
the degenerate-leaf `predicates.emplace_back(node)` in `extractPredicates`, or the
degenerate early return in `permutePredicateClause`, left the suite green.

`src/Common/tests/gtest_query_fuzzer_degenerate_predicate.cpp` calls the two private
helpers directly, so each guard has its own assertion and no dependence on the fuzzer's
random draw. `extractPredicates` must contribute exactly one opaque leaf for a degenerate
node, and the same for a logical `ASTFunction` whose `arguments` is null (the shape that
used to recurse on itself); `permutePredicateClause` must return that node unchanged, or
`not` of it, never a fresh logical call wrapping it. Reverting either guard fails exactly
the assertions for that guard and no others; reverting both fails all three. The
gtest fixtures reach the helpers through the in-tree friend-class idiom, as
`LRUFileCachePriority` and `TemporaryDataOnDisk` already do.

The stateless test loses its `no-llvm-coverage` tag. Its rationale was that `fuzzQuery`
drives the process-global `QueryFuzzer` whose accumulated state varies run-to-run, which
is true of the scalar `fuzzQuery` function and of `03834_fuzz_query_function`, but not of
the table function used here: `FuzzQuerySource` owns a per-source `QueryFuzzer` seeded
from its `random_seed` argument, and `getGlobalASTFuzzer` has no caller under
`src/Storages` or `src/TableFunctions`. The output is byte-identical across repeated runs
and across an intervening load of 500 global-fuzzer calls, so there is nothing
non-deterministic to skip. `04141_fuzz_query_max_query_length` is the same-form
precedent and carries `no-fasttest` only. The remaining `no-fasttest` is load-bearing for
a different reason, now stated in the test: fast builds are `NDEBUG` without sanitizers,
so `chassert` expands to `(void)sizeof(...)` and the statements would pass vacuously.

The comment on the new `extractPredicates` branch said extraction from a degenerate node
"yields nothing" three lines above the code that appends a leaf. It now says the call
contributes exactly one opaque leaf, which is the reason the extraction can no longer
come back empty.

The previous commit message described the test as covering every caller of
`permutePredicateClause` a degenerate node can reach. That is not right: there are four
call sites, the test drives a degenerate node through three of them, and the fourth,
`fuzzMandatoryPredicate`, is covered by construction because the fix is in the shared
callee.

The failure was observed on an unrelated pull request, ClickHouse#112014, whose diff is two `ci/`
Python files. It is linked below as the source of the CI report only, not as the cause.

Related: ClickHouse#112014
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112014&sha=ecda8174cacd8b3ea74e244c0c1231390fcef152&name_0=PR&name_1=AST%20fuzzer%20%28arm_asan_ubsan%29

Co-Authored-By: Claude Opus 5 <[email protected]>
scanhex12 pushed a commit to scanhex12/ClickHouse that referenced this pull request Jul 29, 2026
Follow-up to the review on ClickHouse#112139.

- `extractPredicates` keeps its original `if (func->name == op && func->arguments)`
  condition; the degenerate-argument-list check is nested inside it rather than
  restructuring the branch order.
- Removed `src/Common/tests/gtest_query_fuzzer_degenerate_predicate.cpp` and the
  friend declarations it needed, so `src/Common/QueryFuzzer.h` is untouched again.
  `04651_fuzzer_degenerate_logical_predicate` is the only test now.

With the outer condition restored, a node whose `arguments` is null no longer reaches
the degenerate branch in `extractPredicates`; it falls through to the call into
`permutePredicateClause`, whose own early return breaks the recursion there. Verified
by removing that early return and driving an `ASTFunction{name = "and", arguments =
nullptr}` through it: stack overflow, SIGSEGV.

All four statements of the stateless test still abort on a pristine master build and
pass here. Removing both guards reproduces master exactly (the mutated file is
byte-identical to master's). 50/50 randomized runs of the new test pass, as do
`03031_table_function_fuzzquery`, `03834_fuzz_query_function`,
`04141_fuzz_query_max_query_length`, `04202_storage_fuzzquery_engine` and the
existing `QueryFuzzer` unit tests.

Related: ClickHouse#112014
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112014&sha=ecda8174cacd8b3ea74e244c0c1231390fcef152&name_0=PR&name_1=AST%20fuzzer%20%28arm_asan_ubsan%29
…rops-error-message

Resolves the modify/delete conflict on ci/tests/test_log_parser.py by taking
master's deletion.

PR ClickHouse#114675 ("Remove unit tests for CI scripts") removed most of ci/tests, and
.claude/CLAUDE.md now states: "When you want to test changes in the CI scripts,
you can write and run a throwaway test, but you don't need to commit it to the
repository, because we don't have automated CI tests." Six follow-up commits
restored 43 of the 71 deleted suites; test_log_parser.py was deliberately not
among them, so re-adding it would revert a maintainer decision.

The one-line parser fix is unaffected and still applies to master, which kept
both the index-0 scan and every pattern with a leading '.*'. Re-verified against
master with a throwaway A/B harness, one case per ERROR_PATTERNS entry: five
carriers go from an empty Error section to the full message (memory limit 0->171
bytes, _LIBCPP_ASSERT 0->108, watchdog signal 9 0->107, Sanitizer CHECK failed
0->121, "is located" 0->100) while the entries without a leading '.*' stay
byte-identical (Logical error 36, Segmentation fault 48, Received signal 18,
header-form AddressSanitizer 63).

Master's newer is_check_failed blank-line arm is preserved, and the reworded
comment no longer names the renamed error_patterns attribute.
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Aug 17, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Merged master to resolve the conflict. Head f0d85b72c03795b.

The conflict was a modify/delete on ci/tests/test_log_parser.py: #114675 removed most
of ci/tests, and .claude/CLAUDE.md now says a throwaway test for CI scripts need not
be committed. Six follow-up commits restored 43 of the 71 deleted suites and this one was
deliberately not among them, so I took master's deletion rather than reverting that
decision. The PR is now a single-line change to ci/jobs/scripts/log_parser.py (1 file,
+3/-1); master kept both the index-0 scan and every pattern with a leading .*, so the
fix still applies.

Re-verified against master with a throwaway A/B harness, one case per ERROR_PATTERNS
entry. Five carriers go from an empty Error: section to the full message (memory limit
0 -> 171 bytes, _LIBCPP_ASSERT 0 -> 108, watchdog signal 9 0 -> 107, Sanitizer: CHECK failed: 0 -> 121, is located 0 -> 100); the entries without a leading .* are
byte-identical (Logical error 36, Segmentation fault 48, Received signal 18, header-form
AddressSanitizer 63). Master's newer is_check_failed blank-line arm is preserved.

One behaviour note that the earlier description got wrong. Since master's refactor the
sanitizer name is derived from error_output (log_parser.py:329), so restoring the
message can make a name more specific: a log-prefixed AddressSanitizer: CHECK failed:
record becomes AddressSanitizer (STID: ...) instead of Sanitizer (STID: ...). Scope,
measured in CIDB over 90 days: zero generic-named rows carry CHECK failed, while the 97
rows that do are already named specifically, and all 434 generic Sanitizer (STID: ...)
rows over 30 days are header-form LeakSanitizer, which I measured as name-stable. Where
the rename would fire, the current name labels an empty report, so there is no signature
worth pinning.

@clickhouse-gh

clickhouse-gh Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing f0d85b72c with master 7604e8de0 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of d59f2be34; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 700.94 MiB 697.93 MiB -3.01 MiB (-0.43%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline.

Job report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - f0d85b7

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens.

Check / test Reason Owner / fixing PR
Upgrade check (amd_release) / Unknown job error + Check failed infra, not PR-caused: get_previous_release_tag died on a GitHub API 504 for /releases?page=4, so the job never produced test_results.tsv #112974 (mine, open)

Both rows are one event with one owner: the missing test_results.tsv is the consequence of the
job aborting, not a second defect.

Evidence from job.log (CIDB's test_context_raw only carries the downstream parse error, so it
is not a usable source here):

14:02:32  Exception '504 Server Error: Gateway Time-out for url:
          https://api.github.com/repos/ClickHouse/ClickHouse/releases?page=4&per_page=100'
14:02:41  build_download_helper.APIException: Unable to request data from GH API:
          https://api.github.com/repos/ClickHouse/ClickHouse/releases
14:02:42  Error [Upgrade check (amd_release)] -> Error [Unknown job error]

The job aborted at 14:02:42, before any test ran, which is why ci/tmp/result_path/test_results.tsv
does not exist.

Why this is not caused by this PR, even though this PR changes CI reporting code: the diff is 3
added and 1 removed line in ci/jobs/scripts/log_parser.py, inside parse_failure. That function
is reached from stress_job.py only after a server log exists to parse. Here the job died earlier,
in build_download_helper.get_gh_api during release-tag lookup, so the modified code was never
executed. The failing path also has no 5xx retry: the pre-existing loop retries transport errors and
403 rate limits, and lets every other status raise.

#112974 is the fix for that path: it replaces get_gh_api's retry loop with a shared policy that
retries transient GitHub API failures, including every 5xx, with capped exponential backoff. It is
still open, so there is nothing merged for me to pick up by merging master.

Session id: cron:our-pr-ci-monitor:20260817-150000

@groeneai groeneai added the groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding label Aug 19, 2026
@PedroTadim

Copy link
Copy Markdown
Member

Merging this to fix this PR CI result #118364

@PedroTadim
PedroTadim added this pull request to the merge queue Sep 7, 2026
Merged via the queue into ClickHouse:master with commit 3594fb1 Sep 7, 2026
175 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 7, 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-master PR origin: master/nightly CI monitoring finding 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.

4 participants