Repository navigation
Do not name a stress failure after a query that quotes a failure message - #117963
Conversation
`FuzzerLogParser.parse_failure` took the first line of the server log matching one of its failure patterns, no matter where in the line the match was. A query the server logs is data, and both a test comment and a fuzzed query may contain any text, so a line such as ... <Error> executeQuery: Code: 394. DB::Exception: Query was cancelled. ... (in query: -- Consuming the rowless chunk is `Logical error: 'max_rows > 0'` in debug and sanitizer builds. Every was reported as the failure. In the `Stress test (amd_msan)` run of #115707 that hid the real failure, `Logical error: 'Can't determine table for parallel replicas'` (issue #113292), behind a `max_rows > 0` name that names no failure at all, and the same mis-titled name was also recorded for #116247. The name goes to the CI database and to automatically created fuzzer issues, so such a match splits one failure into per-quote names and buries the failure that actually happened. Skip a match that is preceded on its line by `(in query:` or `(query:` and keep searching. Only the part of the line before the match is checked, so a real failure that quotes the query it happened on keeps its name. The query id of the failed query and the `Format string:` line are now taken from the failure that was found rather than searched for again, so they cannot come from a different, quoting line either. Matching a stack trace string no longer goes through `echo '<string>' | rg`: a log line contains single quotes, which terminated the shell quoting, so the quotes were dropped from the failure name (and the log content reached the shell). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [c4cc3b6] Summary: ✅ AI ReviewSummaryThis PR teaches Findings
Final VerdictStatus:
|
| if not match: | ||
| continue | ||
| if any( | ||
| marker in line[: match.start()] for marker in self.QUERY_TEXT_MARKERS |
There was a problem hiding this comment.
executeQuery logs multi-line queries verbatim, but this guard only checks for (in query: or (query: earlier on the same line. A quoted failure string on a continuation line still gets treated as the failure.
I reproduced this with a synthetic server.log containing:
... (in query: SELECT 1
-- Logical error: quoted in query text
...
<Fatal> : Logical error: real failure
parse_failure() returns Logical error: quoted in query text, so the PR still mis-titles the very case it is trying to fix.
This needs to keep track of being inside quoted query text until the next real log record, not just inspect the current line prefix.
| # Only the matching lines are read - the log itself can be gigabytes. | ||
| output = Shell.get_output( | ||
| f"rg --text -n '{pattern}' {file}" | ||
| f" | head -n {self.MAX_FAILURE_CANDIDATES}", |
There was a problem hiding this comment.
This hard cutoff can hide the real failure entirely. If there are more than 50 quoted matches before the actual fatal line, find_failure exhausts the candidate list here and parse_failure() falls back to Unknown error / Lost connection to server.
I reproduced it with 60 executeQuery lines containing (in query: -- Logical error: quoted ...) before one real Logical error: line: all 50 candidates were skipped here and the actual failure was never reached.
Because fuzzed queries are arbitrary input, a count-based limit changes the parser's contract from "find the first real failure" to "find it only if there are <= 50 false positives first". This needs a streaming search that continues until a non-query match is found, or at least a bound that cannot silently drop the real failure.
Related: #115707
Related: #113292
FuzzerLogParser.parse_failurenamed a stress / AST fuzzer failure after the first line of the server log matching one of its failure patterns, no matter where in the line the match was. A query the server logs is data: both a test comment and a fuzzed query may contain any text, so a line likewas reported as the failure. In the
Stress test (amd_msan)run of #115707 (report) this hid the real failure —Logical error: 'Can't determine table for parallel replicas', the known issue #113292 — behind amax_rows > 0name that names no failure at all; the same mis-titled name was recorded for #116247 as well. The name goes into the CI database and into automatically created fuzzer issues, so such a match splits one failure into per-quote names and buries the failure that actually happened.A match that is preceded on its line by
(in query:or(query:is now skipped and the search continues. Only the part of the line before the match is checked, so a real failure that quotes the query it happened on keeps its name. The query id of the failed query and theFormat string:line are taken from the failure that was found instead of being searched for again, so they cannot come from a different, quoting line either.Matching a stack trace string no longer goes through
echo '<string>' | rg: a log line contains single quotes, which terminated the shell quoting, so the quotes were dropped from the failure name (and the log content reached the shell).Verified on the real 100 MB
clickhouse-server.err.logof the run above: the failure is now namedLogical error: Can't determine table for parallel replicas (STID: 3634-4123). Checked against the previous implementation on plain logical error, assertion, segfault and memory limit logs, in both server log and stack trace string modes: the failure names and infos are unchanged.Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/117963]