Skip to content

Fix CI crash reporter naming logical errors after query-echoed text - #111708

Open
groeneai wants to merge 5 commits into
ClickHouse:masterfrom
groeneai:fix-ci-scraper-query-echo-misattribution
Open

groeneai wants to merge 5 commits into
ClickHouse:masterfrom
groeneai:fix-ci-scraper-query-echo-misattribution

Conversation

@groeneai

@groeneai groeneai commented Jul 23, 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):

...

Description

Related: #108735

The functional/stress crash reporter (FuzzerLogParser in ci/jobs/scripts/log_parser.py, invoked by ClickHouseProc.check_fatal_messages_in_logs) names a failure by running rg -o 'Logical error.*' over the whole clickhouse-server.log and taking the first match. executeQuery logs the full query text (SQL comments included) into the server log, and the signal handler embeds the crashing query inside a <Fatal> record. So when a job hits a real logical-error crash, the reporter can pick up a different test's comment that merely quotes Logical error '...' and use it as the failure name, while the STID and stack come from the actual crash. This mislabels unrelated crashes and pollutes failure tracking.

Concrete example (MasterCI, Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel)): the real crash was <Fatal> : Logical error: 'Got read request from replica 1 for unknown stream ...' (ParallelReplicasReadingCoordinator), but the reporter named it after a regression test's !part.empty() / Bad cast ... comment. This wrongly reopened an unrelated tracking task.

Fix, in log_parser.py:

  • Match Logical error only as the message of a real formatted log record, anchored to the line prefix ^<date> <time> [ tid ] {query_id} <Fatal> [logger]: Logical error: .... A query echo, a comment continuation line, and query text embedded mid-line on a <Fatal> signal record all fail that anchor. The anchor also requires the <Fatal> level and the Logical error: colon, so a benign <Warning> ...: Logical error. Not all polled messages ... is not selected. Genuine logical errors are always emitted via LOG_FATAL (abortOnFailedAssertion), so nothing real is missed. The other patterns (sanitizer, assertion, segfault, signal, memory) are byte-for-byte unchanged.
  • get_failed_query() reuses the query id of the selected fatal record instead of re-grepping the log from the top, so the reported failing query matches the crash. An explicitly empty id (background exception with no query) reports no query rather than an unrelated one; the inline Inconsistent AST formatting query (which aborts before an executeQuery record is logged) is still extracted, scoped to the selected record; and the query id is matched inside its {...} delimiters and escaped, so q2 no longer also matches {q20} and a metacharacter id is literal.

Added regression tests in ci/tests/test_log_parser.py; existing tests unchanged.


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

The functional/stress crash reporter (FuzzerLogParser in
ci/jobs/scripts/log_parser.py, invoked by
ClickHouseProc.check_fatal_messages_in_logs) named a failure by running
`rg -o 'Logical error.*'` over the whole clickhouse-server.log and taking
the first match. executeQuery logs the full query text (including SQL
comments), so when a job hit a real logical-error crash, the reporter could
pick up a different test's comment that merely quotes "Logical error '...'"
and use it as the failure name, while the STID and stack came from the
actual crash. This mislabels unrelated crashes and pollutes failure
tracking.

Changes, in log_parser.py:
- Match a logical error only when it is the message of a real formatted log
  record, anchored to the actual line prefix
  (^<date> <time> [ tid ] {query_id} <Level> [logger]: Logical error ...).
  A query echo, a comment continuation line, and query text embedded on a
  <Fatal> signal record's own line all fail that anchor. Genuine logical
  errors are always emitted via LOG_FATAL (abortOnFailedAssertion), so
  nothing real is missed. The sanitizer, assertion, segfault, signal, and
  memory patterns are unchanged.
- get_failed_query() reuses the query id of the selected fatal record
  instead of re-grepping the log from the top, so the reported failing
  query matches the crash; an explicitly empty id (background exception)
  reports no query rather than an unrelated one; and the inline
  "Inconsistent AST formatting" query (which aborts before an executeQuery
  record is logged) is still extracted. User-controlled query ids are
  matched literally (re.escape + shell single-quote escape) inside their
  exact {...} delimiters, so a metacharacter id runs safely and a prefix id
  (q2) does not attribute a longer id's (q20) query.

Regression tests in ci/tests/test_log_parser.py: a query-echo comment
before a genuine <Fatal> logical error is not used as the name; a
non-fatal <Warning> mentioning the phrase is not selected over a later
fatal; an embedded fake log-record prefix inside a signal record's query
is ignored; the inline Inconsistent AST formatting query is returned even
when a fatal-record query id is supplied and is scoped to the selected
record (not an earlier echo); and a user-controlled query id is treated as
literal shell/regex data with exact {...} matching. Each test was verified
to fail against the pre-fix parser and against a surgically-degraded parser
(anchor removed / escaping reverted), proving it exercises its protection.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? YES. On the real MasterCI server log (job Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel), head 83a5814 — the "!part.empty() STID 5217-505b" job): baseline FuzzerLogParser deterministically names the failure after a query-echo comment (Logical error: 'Bad cast ...'); the fixed parser deterministically names it after the genuine <Fatal> record (Logical error: 'Got read request ... unknown stream ...'). Also a minimal unit repro. No flakiness.
b Root cause explained? YES. ClickHouseProc.check_fatal_messages_in_logs fires on a real <Fatal>/sanitizer hit, then FuzzerLogParser.parse_failure runs rg -o 'Logical error.*' over the WHOLE server log and uses the first match as the failure NAME. executeQuery logs full query text (comments included), and the signal handler embeds the crashing query in a <Fatal> record, so a query merely quoting a crash signature is matched before the real diagnostic. STID/stack come from the real crash → real STID, wrong (comment) name.
c Fix matches root cause? YES. The Logical error server-log match is anchored to the message start of a real formatted record (^<date> <time> [ tid ] {id} <Fatal> [logger]: Logical error: ...), which a query echo / comment continuation / mid-line signal-embedded query never satisfies. This targets the mechanism ("the name is read from arbitrary query-echoed text"), not one test.
d Test intent preserved / new tests added? YES. All 3 existing log_parser tests pass unchanged. Added 7 regression tests (query-echo comment before a genuine <Fatal>; non-fatal <Warning> "Logical error" not selected; fake full log-prefix embedded in a signal record's query ignored; inline Inconsistent AST formatting extracted with a supplied id; empty-id background exception attributes no query; inline-AST scoped to the selected record; query id treated as literal / exact {...} match).
e Demonstrated both directions? YES. Real 1.4 GB log: baseline → wrong comment name; fixed → genuine ParallelReplicas crash (same STID 5217-505b). New unit tests FAIL on the baseline parser and PASS on the fixed parser (verified by reverting).
f Fix general, not a narrow patch? YES. This is the ROOT fix in the shared scraper, not a per-test comment reword. It covers every test that quotes a Logical error signature (20+ .sql files) and the signal-embedded-query case, in one place. Deliberately scoped to the is_logical_error class (the incident); segfault/signal/memory/sanitizer/assertion patterns left byte-for-byte unchanged (a genuine segfault is <Fatal> and was not shown to mislabel; widening would enlarge blast radius in core CI infra) — noted as a possible follow-up.
g Generalizes across inputs? YES (log-line input matrix for a parser). Verified against: empty logger (<Fatal> :), named logger (<Fatal> BaseDaemon:), namespaced logger; single-line and multi-line comment echoes; signal-handler embedded query; benign <Warning>/<Error> "Logical error" without the colon; Inconsistent AST formatting inline query; prefix-vs-exact query id (q2 vs q20) and metacharacter ids. All classified correctly.
h Backward compatible? N/A. Pure CI-tooling change (ci/jobs/scripts, ci/tests). No server setting, on-disk/wire/replication format, or user-facing behavior. SettingsChangesHistory N/A. Only changes how a crash failure is NAMED in CI reports (more accurately); does not suppress any real crash (false-negative-safe: genuine logical errors are always <Fatal>).
i Invariants/contracts preserved? YES. parse_failure's contract (returns name/info/files; is_logical_error still set; STID still from the stack trace; format_message extraction from the -A10 window still works) is preserved. The stack_trace_str branch is untouched. get_failed_query keeps its return contract; query ids are escaped before shell/regex interpolation. No new throw paths; no concurrency.

Session id: cron:clickhouse-author-slot-1:20260723-232900

@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). The reviewer drove the fix from an early per-pattern approach to the final, minimal, regression-free design. Consolidated dispositions across the review:

# Sev Finding Verdict Evidence / action
1 ❌ Failure NAME can be read from arbitrary query-echoed text (the incident) AGREE — fixed Anchored Logical error match to a real formatted log record (^<date> <time> [ tid ] {id} <Fatal> [logger]: Logical error: ...). Verified on the real @83a58143 log: names the genuine ParallelReplicas crash, not the comment.
2 ❌ Broad "strip all query echoes" filter used content heuristics that were adversarially controllable and dropped genuine <Error> executeQuery diagnostics (NEW regression) AGREE — redesigned Removed the broad strip entirely; kept only the structural message-start anchor, which changes only how the logical-error pattern matches and leaves sanitizer/segfault/signal/memory/assertion byte-for-byte as master (zero regressions verified).
3 ❌ Benign non-fatal <Warning> ...: Logical error. Not all polled messages ... (KafkaConsumer) could be selected ahead of a genuine fatal AGREE — fixed Anchor requires the <Fatal> level AND the Logical error: colon (abortOnFailedAssertion always emits both). Regression test added; fails on baseline.
4 ❌ User-controllable query id interpolated into shell+regex (get_failed_query) AGREE — fixed re.escape + single-quote shell-escape on the id; also match inside {...} delimiters so q2 no longer matches {q20}. Literal-id regression test added.
5 ⚠️ Empty-vs-absent query id conflated (background exception attributes an unrelated query) AGREE — fixed _NOT_SUPPLIED sentinel: explicit empty id returns no query; absent id keeps the legacy whole-log scan. Regression test via parse_failure added.
6 ⚠️ Inline Inconsistent AST formatting query lost / not scoped to the selected record AGREE — fixed Inline query extracted first; when an id is supplied the grep is anchored to that record so an earlier comment quoting the phrase can't supply it. Scoped + anchored regression tests added.
7 ⚠️ Regression tests did not discriminate (passed with the fix reverted) AGREE — fixed Rewrote fixtures so each new test FAILS on the baseline parser and PASSES on the fixed parser (verified by reverting); embedded a full mid-line prefix to prove the ^ anchor specifically.
8 ❌ A crafted full log-record prefix embedded mid-line inside a signal record's own query could still match DISAGREE Pre-existing on master (its unanchored Logical error.* matches the same injected text and all prose); the ^ anchor is strictly better. The realistic incident (a prose comment, no fake prefix) is fully fixed. Pathological adversarial edge, out of scope for this incident; documented in the PR.
9 ⚠️ libc++ Hardening assertion X failed not detected DISAGREE The assertion regex does not match it on master either (word-order/case mismatch) and no other pattern does, so master doesn't surface it — this change loses nothing. Pre-existing detection gap, not a regression; out of scope.
10 ⚠️ Whitespace-padded query id trimmed by the shared Shell.get_output DISAGREE The trim is in the shared utility, not this diff; Shell.get_output returns q for { q } even on the baseline. Preserving a space-padded id needs a larger refactor and only degrades query attribution (not crash detection) for a pathological input. Documented limitation.
11 💡 Duplicate anchor rationale comment AGREE — fixed Trimmed the local comment; the full invariant lives beside LOGICAL_ERROR_SERVER_PATTERN.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding. Segfault/signal/memory/sanitizer patterns are left byte-for-byte unchanged; widening them was evaluated and reverted as too broad for core CI infra (noted as a possible follow-up).

Session id: cron:clickhouse-author-slot-1:20260723-232900

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @maxknv - could you review this? It fixes the functional/stress crash reporter (FuzzerLogParser) naming a failure after query text echoed into the server log: a real logical-error crash could be labelled with an unrelated test's comment that merely quotes Logical error '...'. The fix anchors the Logical error match to a genuine <Fatal> log record and reuses that record's query id for the failing-query lookup.

@maxknv maxknv added the can be tested Allows running workflows for external contributors label Jul 24, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [81c79d3]

Summary: ❌

job_name test_name status info comment
Upgrade check (amd_release) FAIL
Error message in clickhouse-server.log (see upgrade_error_messages.txt) FAIL cidb

AI Review

Summary

This PR fixes the original single-line/query-comment misattribution in FuzzerLogParser and preserves exact query-id matching, but the current code still lets multiline echoed text synthesize a fake line-start <Fatal> record. Because that still allows the crash reporter to name a failure after unrelated user-controlled text, the PR does not yet satisfy its core contract.

Findings

❌ Blockers

  • ci/jobs/scripts/log_parser.py:33 [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/111708#discussion_r3797135152] The new anchor is only a line-start check, so a newline inside log_comment or embedded query text can still manufacture a continuation line that is byte-identical to a genuine Logical error record. On current head, the thread's repro still makes parse_failure() return Logical error: 'forged') with fatal_query_id = fake instead of the later genuine {q2} fatal, so unrelated user-controlled text can still rename the reported crash.
    Suggested fix: escape or sanitize newlines in the producer-side fields that are logged verbatim, or switch the parser to an input that preserves real record boundaries so a continuation line cannot satisfy LOGICAL_ERROR_SERVER_PATTERN.
Final Verdict

Status: ❌ Block

Minimum required action: close the remaining multiline log_comment / embedded-query carrier so a continuation line cannot be parsed as the selected fatal record.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 24, 2026
Comment thread ci/jobs/scripts/log_parser.py Resolved
Query ids are arbitrary strings (Context::setCurrentQueryId does not
validate them) and may carry leading/trailing whitespace, e.g. `{ q }`.
parse_failure captured the id via `rg -r '$1'` and additionally called
`.strip()` on it; Shell.get_output also strips its output. A record id
` q ` was therefore reduced to `q`, after which get_failed_query's exact
`{...}` executeQuery lookup no longer matched the real `{ q }` record and
the crashing query was dropped from the reported info (the logical-error
name was still correct).

Extract group 1 of the matched record with re.match instead, so the id
between the `{...}` delimiters is preserved verbatim regardless of the
surrounding-whitespace strip. Add a regression test through the full
parse_failure path using the spaced id `{ q }`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Jul 24, 2026
Master gained five commits in the same FuzzerLogParser code this branch
rewrites (3193d5c, f371033, 33cbc0f, edf3aa8, cf2cfec), all
bounding the `Format string:` search by the matched failure. Both changes are
wanted and neither subsumes the other, so the branch's anchoring is
re-expressed on top of master's bounded-search version rather than reverting
it: the resolved tree differs from master only in this branch's own delta.

The pattern list stays master's class-level ERROR_PATTERNS (it now has two
consumers) and is extended from 3-tuples to 4-tuples with the `server_pattern`
axis, instead of reintroducing a second local copy that could drift.

Two composition points needed real work.

First, the anchored pattern must not simply replace the unanchored one. It
matches only whole formatted server-log records, so on an input with no such
records - stderr.log standing in for an absent server log, which master's new
test_parse_failure_logical_error_file_without_thread_ids feeds - a logical
error stopped being detected at all and the failure was reported as "Unknown
error". It is now used only where it can apply, mirroring the distinction
find_format_string already draws on thread ids. An unconditional fallback was
tried first and rejected: it re-admits what the anchoring exists to exclude,
namely a fully-formed record prefix appearing mid-line inside an echoed query.

Second, find_format_string locates the failure block with `rg -n -m1` on the
pattern that matched. Passing the unanchored pattern makes it land on the
query-echo comment - the very line this branch skips - so master's bounded
search would bound the wrong block. parse_failure now records the pattern that
actually produced the output.

All nine of master's parser tests and all eight of this branch's pass together
(18 with a new arm pinning the second point above). Verified by mutation: each
of the two composition fixes, the anchored scan, the byte-for-byte query id
capture and the id plumbing reddens its own arm when reverted.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

groeneai commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

Merged master to resolve the conflict. Flagging it because the resolution was not mechanical.

Master gained five commits in FuzzerLogParser since this branch's base (3193d5cb66,
f37103303f, 33cbc0f363, edf3aa8a60, cf2cfec309), all bounding the Format string:
search by the matched failure. Both changes are wanted and neither subsumes the other, so I
re-expressed this branch's anchoring on top of that version rather than replaying my older view
of the file: the merge result differs from master only in this branch's own two files. The
pattern list stays the class-level ERROR_PATTERNS (log_parser.py:29) and is extended from
3-tuples to 4-tuples, instead of reintroducing a second local copy that could drift.

Two composition points needed real changes, and one of them was a bug in my branch that only
surfaced against the new code:

  1. The anchored pattern cannot simply replace the unanchored one. It matches whole formatted
    server-log records only. On an input with no such records (stderr.log standing in for an
    absent server log, which test_parse_failure_logical_error_file_without_thread_ids feeds)
    the logical error stopped being detected at all and the failure came out as Unknown error.
    It is now used only where it can apply, mirroring the distinction find_format_string
    (log_parser.py:118) already draws on thread ids. I first tried an unconditional fallback
    and rejected it: it re-admits exactly what the anchoring excludes, a fully-formed record
    prefix appearing mid-line inside an echoed query.

  2. find_format_string locates the failure block with rg -n -m1 on the pattern that matched.
    Passing the unanchored pattern makes it land on the query-echo comment, the line this branch
    exists to skip, so the bounded search would bound the wrong block. parse_failure now
    records the pattern that actually produced the output.

format_string_within_failure_block (log_parser.py:173) deliberately keeps using the
unanchored pattern for its "next failure of any kind" boundary test: a boundary wants maximum
sensitivity, and the anchored form is strictly less sensitive.

All 18 parser tests pass together (9 from master, 9 here, the last of which is a new arm pinning
point 2). Each part is mutation-checked: reverting the point-1 guard reddens master's two
thread-less tests, reverting point 2 reddens the new arm, and disabling the anchored scan, the
byte-for-byte query id capture or the id plumbing reddens the corresponding arms.

This lands on top of an existing approval. The intent of the diff against master is unchanged,
but points 1 and 2 are new code, so the parts worth a second look are the guard in
parse_failure and the pattern it records.

@groeneai

Copy link
Copy Markdown
Collaborator Author

One correction to a claim I made on this branch's review rounds, now that I have measured it on a running server.

I had argued the query id was the only carrier able to forge a whole formatted record, and that no consumer-side rule could close it. Both halves are wrong. Against the anchored LOGICAL_ERROR_SERVER_PATTERN in this PR, a newline in ordinary query text, in log_comment, or in a quoted identifier echoed by an error each produce a record that satisfies the anchor exactly, with a benign query id (measured: 1, 2 and 4 matches respectively, on 26.8.1.1). The query-id carrier is in fact the weakest of the four: because the anchor's \{([^}]*)\} excludes }, every forged message it yields carries a trailing } <Debug> ... tail, so it is the one shape that stays detectable.

So sanitizing the query id would not have closed the attribution hole, and this PR's anchoring is not weakened by leaving it unsanitized. I am not raising a follow-up: the TCP path does lack the control-character strip that HTTPHandler.cpp and PrometheusRequestHandler.cpp already apply, but that asymmetry has no user-reachable consequence beyond log cosmetics, and attribution is defeated by query text regardless of the id.

Master removed ci/tests/test_log_parser.py in
ClickHouse#114675 ("Remove unit tests for CI
scripts"), which produced a modify/delete conflict against the test file this
branch extends. That pull request deleted 71 files under ci/tests and then
restored 39 of them over the following two days, each restore commit naming the
criterion: coverage that is the only focused guard for a still-live CI job or
merge gate. test_log_parser.py was not among the restored files and was not
raised in that pull request's review, so this merge honours the deletion instead
of reinstating it, and the branch now changes only
ci/jobs/scripts/log_parser.py.

The parser change itself is unaffected: master has not touched log_parser.py
since cf2cfec (2026-08-05), which this branch already merged, so the file
is byte-identical to the previously reviewed version.

The 18 assertions the deleted file carried were kept as a throwaway harness and
run against the merged tree, per the guidance added in
ClickHouse#114703 that CI script changes may
be validated with a throwaway test rather than a committed one. All 18 pass, and
each of the five behaviours this branch introduces was confirmed still pinned by
reverting it in turn: stripping the captured query id, bypassing the anchored
server pattern, applying it unconditionally, scanning for the format string with
the unanchored pattern, and dropping the query id passed to get_failed_query.
Every one reddens the corresponding assertion.
@groeneai

Copy link
Copy Markdown
Collaborator Author

Merged master to resolve the conflict. Flagging one decision, since it changes what this pull request contains.

The conflict was a modify/delete on ci/tests/test_log_parser.py, which #114675 removed. That pull request deleted 71 files under ci/tests and then restored 39 of them over the next two days, each restore commit naming the criterion: coverage that is the only focused guard for a still-live CI job or merge gate. test_log_parser.py is one of the 32 that stayed deleted, and it was not raised in that pull request's review. So I honoured the deletion rather than reinstating the file, and this branch now changes only ci/jobs/scripts/log_parser.py (+120/-39).

The parser change itself is untouched: master has no commits to log_parser.py since cf2cfec30956, which this branch already merged, so the file is byte-identical to the version reviewed here.

I kept the 18 assertions the deleted file carried as a throwaway harness and ran them against the merged tree, per the guidance #114703 added for CI script changes. All 18 pass. I also reverted each of the five behaviours this branch introduces in turn, to confirm they are still pinned rather than merely passing: stripping the captured query id, bypassing the anchored server pattern, applying it unconditionally, looking up the format string with the unanchored pattern, and dropping the query id passed to get_failed_query. Each one reddens its corresponding assertion.

# Group 1 is the query id, group 2 the message.
LOGICAL_ERROR_SERVER_PATTERN = (
r"^[0-9]{4}\.[0-9]{2}\.[0-9]{2} [0-9:.]+ \[ [0-9]+ \] "
r"\{([^}]*)\} <Fatal> [A-Za-z0-9_:]*: (Logical error:.*)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This anchor still accepts forged line-start records from user-controlled multiline fields, so the reporter can still name a real logical-error failure after echoed text.

executeQuery logs log_comment verbatim, and the signal handler logs query verbatim. A value containing a newline followed by 2026.07.23 ... {fake} <Fatal> : Logical error: 'forged' becomes a continuation line that satisfies this regex exactly. On current head, parse_failure() then returns the forged name and fatal_query_id = fake instead of the later genuine {q2} fatal. Minimal repro:

2026... {q1} <Debug> executeQuery: (comment: harmless
2026... {fake} <Fatal> : Logical error: 'forged')
...
2026... {q2} <Fatal> : Logical error: 'genuine crash'.

So the PR's core contract still does not hold for multiline log_comment / embedded query text. This needs either producer-side newline escaping/sanitization for those fields or a parser-side discriminator that a continuation line cannot synthesize.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mechanism is real: I ran your example through parse_failure() on the current head and it returns Logical error: 'forged') (stage: Complete) with fatal_query_id = fake, as you describe.

It is not introduced here, and it is not narrowed by anything this PR could do. Same input on pre-fix master gives the identical name, so this is master's behaviour, unchanged.

Two carriers, measured A/B on both parsers:

carrier master this PR
SQL -- comment echoed by executeQuery misattributed correct
raw newline in log_comment / query text (your case) misattributed misattributed

The first one is the carrier this PR exists to fix, and the anchor does fix it: toOneLineQuery re-emits the newline after a Comment token (src/Parsers/toOneLineQuery.cpp:22-26), so the continuation line still carries -- and fails the anchor. Your case has no such prefix, so the continuation is a well-formed record. Nothing regresses either way.

On the parser-side option: I do not think one exists. OwnPatternFormatter::formatExtended writes msg.getText() verbatim (src/Loggers/OwnPatternFormatter.cpp:65) with no escaping, no newline handling and no record terminator, so a continuation line of a multiline message is byte-identical in form to a genuine record. Checked directly against the anchor: forged and genuine lines both match and both yield a well-formed query id and message. There is no property local to the line that separates them, and record boundaries cannot be recovered from a stream that never marked them. That leaves your first option, producer-side escaping, as the only sound remedy, and it changes server logging (executeQuery, the signal handler, the formatter) rather than the reporter.

I am not doing that here: it is a different concern, it would invalidate the existing approval, and there is no observed occurrence to justify the scope. CIDB over 90 days has 0 logical-error failure names carrying the (stage: or (comment: tail such a forgery leaves, against 12078 logical-error rows as a control. That is no evidence of occurrence rather than proof of absence, since a carefully crafted comment would not be distinguishable in that column, so I am recording the residual here rather than filing it.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 295620a

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

177 check runs: 150 skipped, 26 success, 1 failure.

Check / test Reason Owner / fixing PR
Upgrade check (amd_release) / Unknown job error + Check failed get_previous_release_tag died on 422 Unprocessable Entity from releases?page=11&per_page=100 after 4 retries, so no test_results.tsv was written #112974 (ours, open)

The failure is not caused by this PR: the job aborted in the package-download prologue, before
the server started and before any test ran, so log_parser.py was never invoked. CI Tests,
the job that runs pytest ci/tests/, is green on this same commit.

Breadth over 3 days for that signature: 40 rows across 40 distinct pull requests, 0 on master,
with the onset concentrated in a burst today.

Session id: cron:clickhouse-maint-slot-16:20260817-173600

@groeneai groeneai added the groeneai-origin-unknown PR origin: unclassified (legacy task) label Aug 19, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 81c79d3

Every failure below has an owner: a fixing PR, or a full-effort fix task whose fixing-PR link is
posted here when it opens.

Check / test Reason Owner / fixing PR
Upgrade check (amd_release) / Error message in clickhouse-server.log (see upgrade_error_messages.txt) Not introduced here: that row is emitted by tests/docker_scripts/upgrade_runner.sh, which greps the server log for <Error> after the upgrade, and this PR changes only ci/jobs/scripts/log_parser.py, a module imported solely by the AST fuzzer and stress jobs and never by that script. The leaked lines are Cluster: Code: 198 ... Not found address of host (DNS_ERROR) for two unresolvable hostnames. The row is a job-level bucket rather than one defect: measured over the last 30 days in the CI database, it fired on 28 pull requests with 13 distinct error codes behind it and 0 times on master. a fix task is created (investigating at full effort, fixing PR link to follow on this PR)

Session id: cron:our-pr-ci-monitor:20260831-040000

@groeneai

Copy link
Copy Markdown
Collaborator Author

Fixing PR for the Upgrade check (amd_release) / Error message in clickhouse-server.log (DNS_ERROR) line of the CI ledger for 81c79d32dc61180db04e7c3b380e233f4cc36d7b: #117284.

The four leaked <Error> Cluster: ... Not found address of host lines are 04725_distributed_async_insert_long_directory_name's own intentionally-unresolvable Remote() hosts, not anything in this pull request's diff. That artifact contained exactly those 4 lines and nothing else, so the leaf should go green once #117284 is in.

@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Sep 4, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Dear @maxknv, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

This branch has not been deployed

No deployments
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-unknown PR origin: unclassified (legacy task) manual approve Manual approve required to run CI pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants