Skip to content

Do not fail the AST fuzzer job on a server-survived memory limit - #109590

Merged
PedroTadim merged 6 commits into
ClickHouse:masterfrom
groeneai:groeneai/ast-fuzzer-benign-memory-limit-not-error
Jul 27, 2026
Merged

PedroTadim merged 6 commits into
ClickHouse:masterfrom
groeneai:groeneai/ast-fuzzer-benign-memory-limit-not-error

Conversation

@groeneai

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

A fuzzed query can push the server over its memory cap. The memory tracker rejects the allocation with Code 241 (MEMORY_LIMIT_EXCEEDED) and the server stays alive. clickhouse-client returns the server error code as its exit status, so the fuzzer process exits 241 with server_died=0 and a clean server shutdown.

run-fuzzer.sh's post-fuzz liveness loop already treats a 241 as "server alive, busy", but ci/jobs/ast_fuzzer_job.py had no matching branch: fuzzer_exit_code == 241 fell into the catch-all else and turned the whole job into a bogus ERROR ("Client failure").

This makes the Python classifier consistent with the shell loop: a server-survived 241 (server_died == 0 and MEMORY_LIMIT_EXCEEDED present in the fuzzer log) is classified OK. A genuine unbounded-memory bug crashes the server instead and is still caught via server_died / OOM-in-dmesg, so this does not mask real findings.

Adds ci/tests/test_ast_fuzzer_memory_limit.py covering: server-survived 241 -> OK; 241 without log evidence -> not benign; dead server -> not benign; non-241 client failure -> not benign.

CI report showing the failure this addresses (AST fuzzer (amd_debug), server RSS 44.56 GiB > 44.46 GiB cap, Code 241 on SET send_logs_level='fatal' at TCPHandler::receiveHello): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=107236&sha=0c14f334914a3654b21050598ac4def93be109d6&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%29

A fuzzed query can push the server over its memory cap. The memory tracker
rejects the allocation with Code 241 (MEMORY_LIMIT_EXCEEDED) and the server
stays alive; clickhouse-client returns the server error code as its exit
status, so the fuzzer exits 241 with server_died=0 and a clean server shutdown.

run-fuzzer.sh's liveness loop already treats a 241 as "server alive, busy",
but ast_fuzzer_job.py had no matching branch: fuzzer_exit_code 241 fell into
the catch-all else and turned the whole job into a bogus ERROR "Client failure".

Classify a server-survived 241 (server_died=0 and MEMORY_LIMIT_EXCEEDED present
in the fuzzer log) as OK. A genuine unbounded-memory bug crashes the server
instead and is still caught via server_died / OOM-in-dmesg.

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

groeneai commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. The classifier is deterministic given (server_died, fuzzer_exit_code, MLE-in-log). The CI job.log shows the exact inputs: Fuzzer exit code is 241, server_died=0, Server exit code is 0, with MEMORY_LIMIT_EXCEEDED in fuzzer.log.
b Root cause explained? A fuzzed query drove server RSS to 44.56 GiB > the 44.46 GiB cap; the memory tracker rejected the allocation (Code 241) and the server stayed alive. clickhouse-client returns the server code as its exit status -> fuzzer exits 241. ast_fuzzer_job.py had no 241 branch, so it fell into the catch-all else -> bogus job ERROR "Client failure".
c Fix matches root cause? Yes. Adds the missing branch: a server-survived 241 (server_died==0 + MEMORY_LIMIT_EXCEEDED in log) is classified OK, matching what run-fuzzer.sh's liveness loop already does.
d Test intent preserved / new tests added? Yes. New ci/tests/test_ast_fuzzer_memory_limit.py (4 cases). Does not weaken crash detection: a dead server (server_died==1) or a non-241 client failure is still not benign.
e Demonstrated in both directions? Yes. Old classifier: server-survived 241 -> ERROR. New: -> OK. Genuine crash (server_died) -> FAIL in both; non-241 client failure -> ERROR in both.
f Fix is general, not a narrow patch? N/A (CI-harness classification fix, not a C++ code bug). The predicate covers all AST-fuzzer builds uniformly.
g Generalizes across inputs? N/A (CI-harness classification fix, not a C++ code bug).
h Backward compatible? N/A (CI-harness classification fix, not a C++ code bug).
i Invariants/contracts preserved? Yes. Real findings still surface: a memory bug that crashes the server sets server_died=1 (caught) or triggers OOM-in-dmesg (caught); only a server-survived, tracker-rejected 241 is reclassified as benign.

Session id: cron:clickhouse-worker-slot-0:20260707-004100

@groeneai

groeneai commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov — could you review this? It makes the AST fuzzer job classifier consistent with run-fuzzer.sh's liveness loop: a server-survived Code 241 (MEMORY_LIMIT_EXCEEDED, server stays alive) is no longer reported as a job ERROR.

@PedroTadim PedroTadim self-assigned this Jul 7, 2026
@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Jul 7, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [11c387f]

Summary: ✅


AI Review

Summary

This PR makes ci/jobs/ast_fuzzer_job.py treat a terminal, server-origin Code 241 (MEMORY_LIMIT_EXCEEDED) as benign when the server stayed alive, and it adds focused regression coverage in ci/tests/test_ast_fuzzer_memory_limit.py. I did not find a remaining correctness issue in the current implementation or an earlier inline point that still reproduces.

Final Verdict

✅ No actionable findings.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 7, 2026
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Jul 7, 2026
Comment thread ci/jobs/ast_fuzzer_job.py Resolved
The benign path swallowed any fuzzer exit 241 as long as some
MEMORY_LIMIT_EXCEEDED text appeared in fuzzer.log. But clickhouse-client
itself can raise 241 under --max_memory_usage_in_client (see
tests/queries/0_stateless/02003_memory_limit_in_client.sh) and
mainEntryClickHouseClient returns that code verbatim, so an escaped
client/harness 241 was also reported OK, masking a real regression.

Require server-origin evidence: match the transmitted-exception signature
'Received from ... MEMORY_LIMIT_EXCEEDED' (SERVER_MLE_SIGNATURE). A
client-side 241 prints 'Code: 241. ...' with no 'Received from' prefix and
is no longer swallowed. Test updated with client-vs-server cases.

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

groeneai commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

@clickhouse-gh[bot] good catch — the MEMORY_LIMIT_EXCEEDED grep was too broad. A client-side 241 (--max_memory_usage_in_client, see tests/queries/0_stateless/02003_memory_limit_in_client.sh) is returned verbatim by mainEntryClickHouseClient and would also have been swallowed as OK, masking a real client/harness regression.

Fixed in e7277e2: the benign path now keys off a server-origin signature instead of any MLE text.

  • New module constant SERVER_MLE_SIGNATURE = r"Received from.*MEMORY_LIMIT_EXCEEDED". A server-transmitted exception is printed by the client as Received from <host>. DB::Exception: ... (MEMORY_LIMIT_EXCEEDED); a client-side 241 prints Code: 241. DB::Exception: ... (MEMORY_LIMIT_EXCEEDED) with no Received from prefix, so it no longer matches.
  • The ast_fuzzer_job.py call site greps fuzzer.log for SERVER_MLE_SIGNATURE, and _is_benign_memory_limit's third argument is renamed to fuzzer_log_has_server_mle to reflect the narrowed contract.
  • ci/tests/test_ast_fuzzer_memory_limit.py adds test_signature_matches_server_transmitted_241, test_signature_ignores_client_side_241 (real client output lines for both), and test_client_side_241_is_not_benign (241 + server alive + no server-origin marker → NOT benign). Server-survived-241 → OK is kept.

Demonstration (both directions):

OLD grep (broad):         server_matches=True  client_matches=True   <- both swallowed (bug)
NEW grep (server-origin): server_matches=True  client_matches=False  <- client NOT swallowed (fix)
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Unit test drives _is_benign_memory_limit + SERVER_MLE_SIGNATURE on real client output lines; test_signature_ignores_client_side_241 / test_client_side_241_is_not_benign reproduce the masked-regression gap on demand.
b Root cause explained? The grep matched any MEMORY_LIMIT_EXCEEDED line. clickhouse-client raises 241 for its own --max_memory_usage_in_client cap and mainEntryClickHouseClient returns the code verbatim, so a client/harness 241 (exit 241 + MLE text, server alive) satisfied the benign predicate and was reported OK.
c Fix matches root cause? Yes — replaces the broad text match with the server-origin Received from ... MEMORY_LIMIT_EXCEEDED signature, so only a server-transmitted 241 is benign. Directly the marker the bot suggested.
d Test intent preserved / new tests added? Yes. Server-survived-241 → OK retained; added server-vs-client signature cases and a client-side-241 → NOT benign case.
e Both directions demonstrated? Yes — see the OLD-vs-NEW grep table above: OLD swallows the client line (fails to catch the regression), NEW rejects it while still accepting the server line.
f Fix is general across code paths? Yes. There is one benign-241 classification site; the signature is a single shared constant used by both the job grep and the test. No sibling paths classify 241.
g Fix generalizes across inputs? Yes. The discriminator is the Received from transmission prefix, independent of the memory-limit variant (total/user/server), the reported sizes, or host — all server-transmitted MLEs carry it; no client-side MLE does.
h Backward compatible? N/A — CI job classification only; no server behavior, setting, or on-disk/wire format changes. Strictly narrows a false-OK to correctly report client/harness 241s.
i Invariants and contracts preserved? Yes. _is_benign_memory_limit's contract is unchanged except the third arg now means "server-origin MLE present" (renamed accordingly); server_died and exit-code gating are untouched; dead-server and non-241 remain non-benign.

Session id: cron:clickhouse-worker-slot-3:20260708-082000

@groeneai

groeneai commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — e7277e2

Every failure below has a fixing PR owner. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
AST fuzzer (amd_tsan) / LOGICAL_ERROR Arguments of 'intDiv' have incorrect data types in arrayFold (STID 2735-550f) chronic trunk fuzzer LOGICAL_ERROR (10+ unrelated PRs / 0 master, 30d; this PR only edits ci/jobs/ast_fuzzer_job.py, a CI script that cannot produce a query-engine logical error). Root cause: non-const Array(LowCardinality(T)) column/type divergence in arrayFold. Sibling of STID 2735-474b. #109462 (ours, open)
Mergeable Check / PR rollup of the above owned via #109462

Session id: cron:our-pr-ci-monitor:20260708-110000

@groeneai

groeneai commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — e7277e2

Every failure below has an owner (fixing PR or full-effort fix task). Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
AST fuzzer (amd_tsan) / Logical error: Arguments have incorrect data types (STID 2735-550f) chronic trunk logical error (10 hits / 10 unrelated PRs / 0 master, 30d; this PR only edits ci/jobs/ast_fuzzer_job.py + a pytest, cannot produce a server-side function argument-type check) #109462 (ours, open)
Mergeable Check / PR rollup of the above owned via #109462
CH Inc sync private sync CH Inc sync (private, not actionable)

Session id: cron:our-pr-ci-monitor:20260708-113000

Comment thread ci/jobs/ast_fuzzer_job.py Outdated
elif _is_benign_memory_limit(
server_died,
fuzzer_exit_code,
Shell.check(f"rg --text -q '{SERVER_MLE_SIGNATURE}' {fuzzer_log}"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@groeneai shouldn't this check from the last queries sent by the fuzzer?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@groeneai can you check this?

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.

Good catch, you are right. Fixed in 3979bde.

The AST fuzzer swallows a query-side server MEMORY_LIMIT_EXCEEDED and keeps running (Client::processASTFuzzerStep in programs/client/FuzzLoop.cpp resets the exception and returns true), so a 30-minute fuzzer.log accumulates many recovered Received from ... (MEMORY_LIMIT_EXCEEDED) lines that did NOT terminate the run. Only the terminal exception the swallow does not cover (e.g. the TCPHandler::receiveHello handshake path from the original failing log) sets the 241 exit. The old whole-log grep could match a stale earlier server MLE while the actual exit-241 came from something else (e.g. a client-side 241), masking a real regression.

The benign check now scans only the last queries the fuzzer ran: _fuzzer_log_tail_has_server_mle matches SERVER_MLE_SIGNATURE against the fuzzer.log tail (last 50 lines) instead of the whole log.

Pre-PR validation gate (click to expand)
# Check Result
a Deterministic repro? Yes. ci/tests/test_ast_fuzzer_memory_limit.py::test_tail_ignores_stale_server_mle_before_tail: a log with a stale early server MLE + 200 later lines is classified NOT benign; the old whole-log grep returned True on the same input.
b Root cause explained? The fuzzer recovers from query-side server MLEs and continues, so fuzzer.log holds many non-terminal server MLE lines. A whole-log grep matches any of them, so a stale earlier server MLE could swallow a terminal client/harness 241 that exit-241 actually came from.
c Fix matches root cause? Yes. Evidence is now scoped to the log tail (the fuzzer's last queries), tying the benign 241 to its terminal cause.
d Test intent preserved / new tests? Yes. Kept the server-origin-signature and server-survived-241 cases; added 4 tail-scoping tests (terminal server MLE benign; stale-early server MLE NOT benign; terminal client 241 NOT benign; empty log).
e Both directions? Yes. Stale-early + terminal client 241: OLD whole-log = True (wrongly benign), NEW tail = False. Terminal server 241: NEW tail = True (benign preserved).
f General, not narrow? N/A (CI-script classification fix, not a code bug).
g Generalizes across inputs? N/A.
h Backward compatible? N/A (CI job classification only).
i Invariants preserved? Yes. _is_benign_memory_limit still gates on server_died==0 AND exit==241 AND server-origin evidence; only the evidence source narrowed from whole-log to tail.

Session id: cron:clickhouse-worker-slot-0:20260714-160800

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.

3979bde still does not key this off the terminal query. In ci/jobs/ast_fuzzer_job.py:71-72 _fuzzer_log_tail_has_server_mle only searches the last 50 lines, so a recovered server-side MEMORY_LIMIT_EXCEEDED from step N can still sit in that window while the actual exit-241 from step N+1 is client-side. I reproduced that against the current helper with a log containing one swallowed server MLE, 15 stack-frame lines, then a later Code: 241. DB::Exception: Client memory limit exceeded; _fuzzer_log_tail_has_server_mle returned True, so run_fuzz_job would still classify the run as OK. This still needs to anchor on the last query block / last Dump of fuzzed AST: section rather than an arbitrary tail window.

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.

Fixed in 6d86f07. Replaced the fixed 50-line tail with terminal-query-block anchoring: _terminal_query_block() returns the text after the last Dump of fuzzed AST: marker (printed by programs/client/FuzzLoop.cpp:341 before each step executes), and _fuzzer_log_terminal_block_has_server_mle() searches only that block. A server-side MLE swallowed on step N sits inside step N's block, before the last dump marker, so it can no longer count as evidence for a terminal 241 from step N+1. Your exact reproduction (swallowed server MLE + 15 frames + later client-side Code: 241) now returns False and is covered by test_terminal_block_reproduction_from_review. When no dump marker is present (a startup/handshake 241 before any fuzz step) the read tail is treated as the terminal region, so the original TCPHandler::receiveHello false positive stays classified benign.

Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. test_terminal_block_reproduction_from_review reconstructs the exact log shape you gave (swallowed server MLE, 15 stack frames, terminal client-side Code: 241) and asserts it is NOT benign.
b Root cause explained? The AST fuzzer swallows query-side server MEMORY_LIMIT_EXCEEDED and keeps running (Client::processASTFuzzerStep), so recovered Received from ... (MEMORY_LIMIT_EXCEEDED) lines from earlier steps stay in the log. A fixed 50-line/64 KiB window can straddle two steps, letting an earlier swallowed server MLE and a later client-side 241 share the window, so the run was wrongly classified OK.
c Fix matches root cause? Yes. The search is scoped to the terminal step (text after the last Dump of fuzzed AST:) — the only step whose outcome sets the exit code — instead of a size-based window that can cross step boundaries.
d Test intent preserved / new tests added? Yes. Kept the server-survived-241 -> OK case; added terminal-block tests: server MLE after last dump -> benign, earlier-step server MLE -> not benign, the reviewer repro -> not benign, terminal client-side 241 -> not benign, no-dump-marker startup 241 -> benign, empty log -> False. 12/12 pass.
e Demonstrated in both directions? Yes. Reviewer repro: old 50-line tail matches (wrongly benign) -> True; new terminal-block -> False. Terminal server-241 -> new terminal-block True (benign preserved).
f Fix is general, not a narrow patch? Anchoring on the terminal query block covers any earlier-step swallowed limit, not just the 15-frame gap in the repro; the bounded read (256 KiB) stays inside the terminal block by construction.
g Generalizes across inputs? N/A (CI-script log-classification fix, no ClickHouse code path / datatype surface).
h Backward compatible? N/A (CI job classification only; no settings, formats, or user-visible behavior).
i Invariants/contracts preserved? Yes. _is_benign_memory_limit still requires server_died == 0 and fuzzer_exit_code == 241; the only change is tightening the third condition from a fixed tail window to the terminal block.

Session id: cron:clickhouse-worker-slot-10:20260716-103900

The fuzzer swallows query-side server MEMORY_LIMIT_EXCEEDED and keeps running
(Client::processASTFuzzerStep), so a 30-min fuzzer.log holds many recovered
server MLE lines that did not terminate the run. A whole-log grep could match
a stale one and wrongly classify a terminal client/harness 241 as OK. Scan
only the tail so the benign 241 is attributed to its actual terminal cause.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@PedroTadim
PedroTadim enabled auto-merge July 16, 2026 10:14
…ry block

A fixed 50-line tail can hold a swallowed server-side MEMORY_LIMIT_EXCEEDED
from step N together with a terminal client-side 241 from step N+1 when only a
few stack frames separate them, so the whole run would still be classified OK
and mask a real client/harness regression. Scope the server-MLE search to the
text after the last 'Dump of fuzzed AST:' marker (the terminal step whose
outcome sets the exit code) instead of a fixed-size tail window.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
auto-merge was automatically disabled July 16, 2026 10:46

Head branch was pushed to by a user without write access

…marker

Extend the benign-Code-241 classifier so it fires on the real PR ClickHouse#109006 log,
which two independent gaps caused it to miss, and harden the terminal-cause check.

1. Signature. SERVER_MLE_SIGNATURE required "Received from" and the enum
   "MEMORY_LIMIT_EXCEEDED" on one line, but a real server-transmitted limit
   prints the prose "(total) memory limit exceeded" on the "Received from" line
   and the enum on a separate line, so it matched nothing. Match either the
   enum or the prose form; the "Received from" prefix keeps it server-origin, so
   a client-side --max_memory_usage_in_client 241 is still not treated benign.

2. Terminal-block anchor. The block was anchored on the last "Dump of fuzzed
   AST:" marker, which is printed to stdout. run-fuzzer.sh merges the streams
   with "> fuzzer.log 2>&1"; stdout is block-buffered when redirected, so the
   terminal step's dump is flushed at process exit AFTER its own unbuffered
   stderr exception, and the last dump marker is a trailing re-dump past the
   evidence. Anchor on the last "Fuzzing step N out of M" marker instead
   (stderr, causally ordered). No marker (a startup/handshake 241 before any
   step, or BuzzHouse) falls back to the read tail, as before.

3. Terminal-cause ordering. The terminal block can still hold a server limit the
   run recovered from earlier followed by a later client/harness 241 -- a
   recovered query limit then a client-side reconnect/handshake 241 within a
   step, or the same across a markerless BuzzHouse/startup tail. Treat it as
   benign only when no client-origin 241 line (a "Code: 241" line with no
   "Received from" prefix) appears after the last server-origin MLE, so a later
   client/harness 241 still surfaces while an earlier recovered client 241 does
   not veto a genuinely terminal server limit.

The terminal-step invariant from earlier review rounds is preserved: a
swallowed earlier-step query MLE cannot mask a later client 241, both because it
sits before the terminal step's "Fuzzing step" marker and because a client 241
after the last server MLE now vetoes the benign classification.

Regression tests: a prose-form signature case, a fixture built from the real
log's shape (prose MLE + trailing buffered dump), and ordering cases (a later
client 241 is not benign in both the marker and no-marker forms; a terminal
server limit after an earlier recovered client 241 is benign); the prior
invariant tests are kept.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@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; 2 findings across 1 full pass + 1 delta recheck).

# Sev Finding Verdict Evidence / action
1 ❌ No-marker fallback (BuzzHouse prints no Fuzzing step marker) scans the whole read tail, so an earlier recovered server MLE could mask a later client/harness 241 AGREE — fixed @ 11c387f Added CLIENT_241_SIGNATURE (a Code: 241 line with no Received from prefix); benign only when no client-origin 241 line follows the last server-origin MLE. Real #109006 log stays benign (verified).
2 ❌ The first guard returned benign on any server MLE inside a marker-delimited block, bypassing the ordering check (a step recovering a query limit then exiting on a client-side reconnect 241 would be wrongly benign) AGREE — fixed @ 11c387f Dropped the marker shortcut; the "no client-origin 241 after the last server MLE" ordering check now applies to both the marker and no-marker forms. Real log: 2 server MLEs, 0 client-origin 241 after the last → benign.

Severity: ❌ blocker / ⚠️ major / 💡 nit. Both findings verified against the real PR #109006 fuzzer.log and the 18-case pytest.

Session id: cron:clickhouse-author-slot-0:20260721-071501

@groeneai

Copy link
Copy Markdown
Collaborator Author

Extended the benign-241 classifier to cover the real #109006 log shape (@ 11c387f). Two gaps, plus a hardening: (1) the server-MLE signature only matched the enum MEMORY_LIMIT_EXCEEDED, but real server-transmitted limits print the prose (total) memory limit exceeded on the Received from line and the enum on a separate line — now matches either; (2) the terminal-block anchor was the stdout Dump of fuzzed AST: marker, which (with > fuzzer.log 2>&1) is block-buffered and flushed at process exit AFTER the terminal stderr exception, so the last dump marker is a trailing re-dump past the evidence — now anchors on the stderr Fuzzing step N out of M marker; (3) a terminal-cause ordering guard so a later client/harness 241 (after the last server MLE) is not masked, in both the marker and no-marker (BuzzHouse/startup) forms.

Verified end-to-end against the real #109006 fuzzer.log: the classifier returned False before this change (job wrongly ERROR) and True after (correctly benign). 18/18 pytest.

Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. ci/tests/test_ast_fuzzer_memory_limit.py (18 cases) + an end-to-end check of the classifier against the real fuzzer.log reproduce both directions on demand; no probabilistic component.
b Root cause explained? Two gaps: the signature required enum + Received from on one line, but the real server MLE splits prose (on the Received from line) from the enum (next line); and the terminal-block anchor used the stdout dump marker, which is block-buffered so the terminal step's dump flushes at exit AFTER its stderr exception, landing past the evidence.
c Fix matches root cause? Yes. (1) Signature also matches the prose form, still server-origin (keeps the Received from prefix). (2) Anchor moved to the causally-ordered stderr Fuzzing step marker. (3) Ordering guard rejects benign when a client-origin 241 follows the last server MLE.
d Test intent preserved / new tests added? Yes. Kept every prior invariant test; added prose-form signature, a real-log reconnect-path + trailing-buffered-dump fixture, and ordering cases (later client 241 → not benign in both marker and no-marker forms; terminal server limit after an earlier recovered client 241 → benign).
e Both directions demonstrated? Yes. Real fuzzer.log: pre-fix False (bogus ERROR), post-fix True (benign).
f Fix is general across code paths? N/A (CI-harness classification fix, not a C++ code bug). One classification site; the guard applies uniformly to AST-fuzzer and BuzzHouse.
g Fix generalizes across inputs? N/A (CI-harness classification fix, not a code bug). Signature matches enum OR prose and any limit variant (total/user/server) via the Received from prefix; the enum single-line form still matches (regression-tested).
h Backward compatible? N/A (CI job classification only; no server behavior, setting, or on-disk/wire format change). Strictly narrows a false-ERROR to correctly-OK for a server-survived 241 while keeping client/harness 241s reported.
i Invariants and contracts preserved? Yes. _is_benign_memory_limit still gates on server_died == 0 AND fuzzer_exit_code == 241 AND server-origin evidence; a swallowed earlier-step query MLE cannot mask a later client 241 (it sits before the terminal step marker, and a client 241 after the last server MLE vetoes benign).

Session id: cron:clickhouse-author-slot-0:20260721-071501

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @PedroTadim — this addresses the terminal-query concern you raised: the classifier now anchors the terminal block on the stderr Fuzzing step marker (the previous Dump of fuzzed AST: anchor is stdout, block-buffered, so it flushed after the terminal exception), matches the prose server-MLE form, and rejects benign when a client/harness 241 follows the last server MLE. Verified against the real #109006 fuzzer.log.

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 manual approve Manual approve required to run CI pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants