Skip to content

Report the fuzzer jobs' host OOM as a named result again - #116359

Merged
alexey-milovidov merged 7 commits into
ClickHouse:masterfrom
groeneai:fuzzer-oom-named-result
Sep 19, 2026
Merged

alexey-milovidov merged 7 commits into
ClickHouse:masterfrom
groeneai:fuzzer-oom-named-result

Conversation

@groeneai

@groeneai groeneai commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #108689

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

When the kernel OOM killer kills the server, AST fuzzer (amd_debug*) and
BuzzHouse (amd_debug) reported a bare job-level error with an empty
test_name. Every per-test CIDB query filters test_name != '', so the row was
hidden: 35 rows across 22 pull requests over 90 days, each exactly the
19-byte ERROR: OOM in dmesg.

Commit 6a8fa92277b0d2f caused it, replacing this branch's
Result.from_commands_run(name="OOM in dmesg", ...) with a bare
info.append(...); CIDBClient takes test_name from a sub-result's name.
Only the fuzzer surfaces regressed; the other two carriers kept the named shape.

This restores the named result, reusing the dmesg dump and grep already there,
and also names the container (cgroup) kill. The grep matched host-global
shapes only, while a cgroup kill writes oom-kill:constraint=CONSTRAINT_MEMCG
and Memory cgroup out of memory: Killed process, whose lowercase out of memory the existing capital-O pattern cannot match. While it missed,
FuzzerLogParser fell through to Server unresponsive: memory limit exceeded,
named from whichever Code: 241 was last in the server log, that is, a
bystander query: 90 rows across 42 pull requests in 30 days.

Measured on two real captures of cgroup kills of clickhouse-serv (#118877,
#120028): the three old patterns match 0 lines, both new ones 1 each. The
global-OOM capture still matches, an OOM-free one still does not, and removing
both new patterns restores the miss.

One downstream effect is intended: a cgroup row now lands as the synthetic OOM in dmesg instead of the misattributed name, so revert_ci_regressions.py reads
it as an aborted run rather than spending an investigation slot on a bystander
query. That matches how the host-global kill is already treated.

No in-tree test: the merge on this branch accepted the removal of ci/tests, and
nothing executes that directory, so a file there could not redden. I can add one
to ci/tests/test_e2e.py if wanted.


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

Version info

  • Merged into: 26.10.1.234-master (included in 26.10 and later)

When the kernel OOM killer kills the server, `AST fuzzer (amd_debug*)` and
`BuzzHouse (amd_debug)` report it as a bare job-level `error` whose entire CIDB
context is the 19-byte string `ERROR: OOM in dmesg`, with an empty `test_name`.
An empty `test_name` makes the row invisible to every per-test CIDB query, since
those filter `test_name != ''`. Over the last 90 days that is 35 rows across 22
pull requests, every one of them exactly 19 bytes.

This is a regression rather than a missing feature. Commit 6a8fa92 ("CI:
Improvments for CI report info and error parsing") replaced this branch's

    oom_result = Result.from_commands_run(name="OOM in dmesg", command=...)
    if not oom_result.is_ok():
        oom_result.set_status(Result.StatusExtended.FAIL)
        results.append(oom_result)

with a bare `info.append("ERROR: OOM in dmesg")`. `CIDBClient` takes a row's
`test_name` from a sub-result's name, so once no sub-result is constructed the
name is empty. The sibling reporters kept the original shape, which is why only
the fuzzer surfaces regressed: both `clickhouse_proc.py` and
`integration_test_job.py` still build a named `OOM in dmesg` result.

Restore it, reusing the `dmesg` dump and grep that are already in this branch.
The grep is negated, so it exits non-zero exactly when an OOM line is present
and `with_info_on_failure` then captures the killed process, its pid, its
`anon-rss` and the `constraint=`/`global_oom` kind into the row - evidence that
today is only reachable by downloading `dmesg.log` by hand. That is also why no
bespoke dmesg parser is needed.

Two deliberate differences from the deleted original. `Result.StatusExtended`
no longer exists, so the status is set through `Result.Status`; and the value is
`ERROR` rather than `FAIL` because `Result.create_from` resolves an `ERROR` child
to a job-level `error` and a `FAIL` child to `failure`, so `ERROR` is what keeps
the job status exactly as it is today. `results = []` moves above the `is_failed`
block because the OOM branch precedes its old declaration site; the list is only
read further down, so this changes no control flow.

Scope. This is diagnosability only. It raises no limit, and it recovers no
discarded fuzzer finding: across all 15 bare-OOM instances that were never
re-run, `fatal.log` is absent on 15 of 15, and the surfacing run's own
200,837-line server log holds no `<Fatal>` line at all. The `FuzzerLogParser`
gate is left alone on purpose - all 47 log lines it would match on that run are
benign `SystemLog` `flushImpl` victims of the memory shortage, so running it
there would assert the server died of its own memory limit when in fact the
kernel killed it.

The three other OOM-detection sites are deliberately untouched.
`clickhouse_proc.py` and `integration_test_job.py` already name their result;
`stress_job.py` forces the job to `OK` ("OOM error (allowed in stress tests)"),
so it has no error row to name; and `Utils.is_killed_with_oom` has no callers.

The fixture is named `.txt`, not `.log`, because the repository `.gitignore`
excludes `*.log` and would silently drop it from the commit.
The test helper seeded the block's entry status as ERROR, but a host OOM
SIGKILLs the server, so production reaches this branch on the dead-server
path with FAIL (the status is initialised to FAIL and that arm does not
reassign it). Only the exit-227 and catch-all paths arrive with ERROR.

Because every case both seeded and expected ERROR, the FAIL -> ERROR raise
was asserted by nothing, and hoisting the raise out of the OOM-detected
guard left all 24 tests green. That mutation is not cosmetic: the caller
gates FuzzerLogParser on `is_failed and status != ERROR`, so an
unconditional ERROR would disable the parser for every dead-server run and
drop the named sub-result for real fuzzer findings.

Seed FAIL by default, assert the raise on the OOM path, pin ERROR
idempotence for the other two entry paths, and assert FAIL is preserved
when no OOM line is found. Three further mutation arms cover the three new
assertions, each reddening a disjoint subset.

Also move the regression history out of the section comment: it is
fix-referential, so it belongs here rather than at the code site.
The `results` list is read by `Result.create_from` at the end of the reporting
flow, so initializing it after the host-OOM branch would discard the named
sub-result while still reporting a job-level `error`: the public check status
would be unchanged and only the CIDB row would go back to `test_name = ''`.
The existing block test cannot observe that ordering, because both the
initialization and the `create_from` consumption sit outside the sliced block
and the block's namespace supplies its own `results`.

Slice the reporting flow from the status ladder instead, seeding none of the
names it assigns, and assert the named child reaches the job result. Anchoring
upstream of every statement under test keeps a mutation inside the slice rather
than moving the anchor.
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect labels Aug 25, 2026
@groeneai

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

Three review rounds, each a cold read of the tree plus an independent second-model pass.
Final round: 0 findings. Nothing outstanding.

# Finding Verdict
❌ The host-OOM branch is entered with FAIL, not ERROR, so the FAIL -> ERROR raise this change relies on was asserted by nothing; and because every test both seeded and expected ERROR, hoisting the assignment out of its guard passed the whole suite. That mutation would silently disable FuzzerLogParser for every server_died run. AGREE, fixed. The three negative tests now assert FAIL is preserved, which is what kills the mutation.
❌ Moving results = [] back below the OOM branch also passed the whole suite, and it reintroduces exactly the defect this change fixes: the job status stays error, only the named child is lost. AGREE, fixed. A second extractor covers the whole reporting flow, so the child is pinned end to end.
⚠️ A comment in the tests recounted the regression's history. AGREE, condensed to the invariant.
💡 A comment explaining why the fixture is .txt and not .log was flagged as narrative. DISAGREE: the root .gitignore excludes *.log, so deleting it invites the mistake it documents. git check-ignore confirms the .txt path is not ignored.
💡 The end-to-end test drives the non-targeted job shape; 28 of the 35 affected rows are targeted variants, which carry an extra child. Noted, not blocking. Traced by hand: create_from skips an OK child and breaks on the ERROR one, and a CIDB row is emitted per child, so the named row appears in both shapes. All three tests found by coverage construction sites are OK, so it cannot mask the ERROR.

Ten mutations of the new code each redden a distinct subset of the tests, and renaming the
fixture away reddens all of them, so none passes vacuously.

@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Aug 25, 2026
@clickhouse-gh clickhouse-gh Bot closed this Aug 25, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Aug 25, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, at the reporter level: pytest ci/tests/test_ast_fuzzer_memory_limit.py -k oom_in_dmesg fails deterministically on master (0 sub-results appended) against the real dmesg.log from #116245. The end-to-end condition is a host OOM inside a CI container, which I cannot produce locally; stated as such in the description rather than promised.
b Root cause explained? Yes. CIDBClient sets a row's test_name from a sub-result's name; commit 6a8fa92277b0d2f deleted the only sub-result this branch built, replacing it with a bare info.append, so the row lands with test_name = '' and no per-test query can see it.
c Fix matches root cause? Yes: it restores the deleted named Result at the same site, using the same from_commands_run shape the sibling reporters still use. No limit raised, no timeout widened, no signal suppressed.
d Test intent preserved / new tests added? Yes. No existing test deleted or weakened (all 19 pre-existing tests in that file still pass); 8 tests added, 3 of which fail on master. Ten mutations of the new code each redden a distinct subset (status flipped to OK; results.append dropped; name emptied; grep un-negated; the status raise hoisted out of its guard; the status set in the dmesg-unavailable arm; the raise deleted; the results initialization moved back below the OOM branch, in both its re-added and moved forms; the FuzzerLogParser gate un-gated), and renaming the fixture away reddens all the OOM tests, so none of them passes vacuously.
e Both directions demonstrated? Yes. On master: 3 failed, 23 passed, each on the assertion it exists for (len([]) == 1, and [] == ['OOM in dmesg'] for the end-to-end one). With the change: 26 passed in this file, and no new failure in the full ci/tests/ run (1117 passed, 12 failed, all 12 reproduced with my three files reverted to master).
f Fix is general across code paths? Yes. grep -rn 'info.append("ERROR' ci/jobs/ returns exactly one site, the one fixed, and one change covers both fuzzer families because buzzhouse_job.py calls the same run_fuzz_job. The other three OOM-detection sites are deliberately untouched: clickhouse_proc.py and integration_test_job.py already name their result; stress_job.py forces the job to OK ("OOM error (allowed in stress tests)") so there is no error row to name; Utils.is_killed_with_oom has no callers.
g Fix generalizes across inputs (params/datatypes/wrappers)? Yes, over the input space that exists here: the real OOM block, a dmesg with no OOM line, an empty dmesg, and dmesg itself unavailable. Sanitizer arms keep their existing early-OK path, which accounts for 0 of the 35 rows by design.
h Backward compatible? (maintainer-approved exception only) Yes. CI reporting only: no setting, no serialization format, no user-facing surface, so SettingsChangesHistory.cpp is not involved. ERROR rather than FAIL keeps the job-level status at error, so no existing green or red flips.
i Invariants and contracts preserved? Yes. Hoisting results = [] changes no control flow (the list is only read further down). The FuzzerLogParser gate is unchanged, so the parser still cannot run on the OOM path. test_bugfix_validation_inverter.py, which treats an OOM in dmesg log check as clean, still passes, and no fuzzer check is a bugfix-validation job.

Session id: cron:clickhouse-impl-slot-6:20260825-114100

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @leshikus, could you review this? A CI report refactor dropped the named OOM in dmesg sub-result from the fuzzer jobs' host-OOM branch, and since CIDBClient takes a row's test_name from a sub-result, those failures have been landing in the CI database with an empty test_name, invisible to every per-test query. This restores the named result, reusing the dmesg grep already there.

@clickhouse-gh

clickhouse-gh Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [577ab1a]

Summary: ✅


AI Review

Summary

This PR restores the named OOM in dmesg sub-result for the fuzzer jobs, teaches that branch to recognize container-scoped OOM kills, and excludes the synthetic name from revert_ci_regressions.py investigations. The revert-job allowlist change looks correct, but the new memcg match is too broad for an uncleared host dmesg buffer and can still relabel a real fuzzer failure as synthetic OOM in dmesg.

Findings

⚠️ Majors

  • [ci/jobs/ast_fuzzer_job.py:549] The new CONSTRAINT_MEMCG / Memory cgroup out of memory alternation is unscoped even though this job still reads a host-global dmesg snapshot with no per-run clearing. If an earlier container on the same runner left a memcg OOM line in the buffer, this branch now treats any later dead-server failure as OOM in dmesg, forces status = ERROR, and skips FuzzerLogParser, hiding the real fuzzer finding. Scope the memcg case to the current server (task=clickhouse-serv or this container's cgroup) or clear/window dmesg before trusting CONSTRAINT_MEMCG.
  • [ci/jobs/ast_fuzzer_job.py:547] [dismissed by author -- https://github.com/Report the fuzzer jobs' host OOM as a named result again #116359#discussion_r3888984426] This branch still ships the OOM in dmesg / synthetic-name behavior without committed, executed regression coverage on the PR head. The earlier focused tests were dropped during the merge and the current branch has no replacement wired into CI, so the only proof now lives in the commit message and a throwaway local run. A focused automated test for the named-result and synthetic-name behavior would close that gap.
Final Verdict

Changes requested.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 25, 2026
Comment thread ci/jobs/ast_fuzzer_job.py Resolved
Comment thread ci/jobs/ast_fuzzer_job.py Resolved
Restoring the named `OOM in dmesg` sub-result in the fuzzer job adds a third
carrier of that test name, and the hourly revert job filters harness rows by
name alone. Without the name in `SYNTHETIC_TEST_NAMES` a repeated host OOM on
master reaches two places it must not.

`select_failures` would investigate it: the name records that a dmesg OOM line
was present, so there is no test case behind it and no change to attribute a
revert to, and with a few investigations per run it would take a slot a real
repeated regression needed.

`commits_since_the_failure_query` would also count an OOM-killed run as having
exercised the check and not as aborted, so the run's silence about an unrelated
failure would read as evidence that the failure is gone -- green evidence from
a run the kernel stopped, which is what the list exists to keep out.

The other two carriers, `clickhouse_proc.py` and `integration_test_job.py`,
already emit this name on master, so the gap is pre-existing rather than
introduced here; the fuzzer job merely adds to it.
The reasoning about why a host-OOM row has no test case behind it belongs in
the commit message rather than beside the name; no sibling name in the set
carries a per-name comment, and the invariant a reader needs at that spot is
only what the name refers to.
Master removed the whole `ci/tests` directory in `5b3d66b1a66` ("Remove ci/tests
(attempt 2)", 51 files, no replacement location), so this branch's edits under
`ci/tests` arrive as modify/delete conflicts. Accepted the removal, and dropped
the files this branch adds there as well - keeping them would re-create a
directory master deliberately deleted.

The product change this pull request is about is unaffected; what is lost is its
CI-side unit coverage, which has nowhere to live upstream any more.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Comment thread ci/jobs/ast_fuzzer_job.py
# needs a named one to stay greppable. The grep is negated: it
# exits non-zero exactly when an OOM line is present, and
# `with_info_on_failure` captures that line into `info`.
oom_result = Result.from_commands_run(

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.

The current head no longer keeps any regression test for this path. The PR originally had focused checks that proved both the non-empty test_name here and the matching SYNTHETIC_TEST_NAMES exclusion, but those tests were dropped during the merge and this now lands as unexercised Python. Because the host-OOM branch depends on a dmesg condition that this PR's CI never hit, the next refactor can silently regress back to an empty test_name or make revert_ci_regressions.py investigate host OOM rows again. Please restore focused in-tree coverage for both branches in a maintained Python test target.

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 premise is right: this head has no test for either branch. That was deliberate, not a merge accident. ci/tests and the job that ran it were deleted from master in 8ff3720644b2 ("Remove the CI Tests job along with ci/tests"), and the head commit here, c79d867626d2, is @ alexey-milovidov merging that removal into this branch.

So there is no maintained Python test target to re-home into. Measured on master: no pytest or unittest invocation over ci/ in ci/defs, .github/workflows or ci/praktika; ci/jobs/ci_tests_job.py is gone; and the only surviving ci/tests references are docstring examples in ci/praktika/cache.py whose paths no longer exist. .claude/CLAUDE.md:190 states the policy: "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." (ci/tests/ does hold one file again, test_runner_docker_daemon_death_infra.py, reintroduced by the merge of #109673 at 6038ecb6fa22; nothing runs that one either.) Re-adding a file there would merge without conflict and then never execute, so it would close this comment without testing anything.

What I did instead, per that line: ran both cases as an uncommitted throwaway against this head. 210 pass, and the two regressions you name each redden a distinct test:

  • name="OOM in dmesg" reverted to name="": test_oom_in_dmesg_appends_named_sub_result and test_named_oom_child_survives_to_job_result fail.
  • "OOM in dmesg" dropped from SYNTHETIC_TEST_NAMES: test_a_host_oom_row_is_not_investigated_and_does_not_count_as_a_run fails.

Both properties hold on this head, verified but not committed, which is the state the repository asks for. The two files are in this branch's history at 89f712664c7579a if a runner is reintroduced.

@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Sep 4, 2026
@groeneai groeneai mentioned this pull request Sep 17, 2026
1 task done
The dmesg grep in the fuzzer jobs' OOM branch matched host-global kills only:
'Out of memory: Killed process', 'oom_reaper: reaped process' and
'oom-kill:constraint=CONSTRAINT_NONE'.

A cgroup-scoped kill writes none of them. The kernel prints
'oom-kill:constraint=CONSTRAINT_MEMCG' for the constraint, and its victim line
reads 'Memory cgroup out of memory: Killed process', whose lowercase
'out of memory' the existing capital-O pattern cannot match.

While that branch stays silent, FuzzerLogParser falls through to
'Server unresponsive: memory limit exceeded' and names whichever Code: 241 was
last in the server log, that is, a bystander query instead of the kill. That
fall-through name carries 90 rows across 42 pull requests in the last 30 days,
75 of them on the AST fuzzer amd_debug family.

Measured on two real dmesg captures of memcg kills of clickhouse-serv, from
ClickHouse#118877 head f082cbb and ClickHouse#120028 head 53f179a: the three existing patterns
match 0 lines in both, and the two added patterns match 1 line each, so the
branch does not fire before this change and does after it. The global-OOM
capture recorded earlier on this branch still matches, and the same capture
with its OOM lines removed still does not.

One downstream effect is deliberate and worth naming: a cgroup-scoped row now
lands as the synthetic 'OOM in dmesg' rather than as 'Server unresponsive:
memory limit exceeded', so revert_ci_regressions.py treats it as an aborted run
instead of investigating it. That is the intended reading, and it matches the
treatment this branch already gives the host-global kill. The old name was
assigned from whichever Code: 241 happened to be last in the server log, so it
named a bystander query and no single change to revert, while spending one of
the four investigation slots a run has. Per that file's own docstring an
over-inclusive list costs at most a wasted investigation, never a wrong revert.
Comment thread ci/jobs/ast_fuzzer_job.py
# `with_info_on_failure` captures that line into `info`.
oom_result = Result.from_commands_run(
name="OOM in dmesg",
command=f"! cat {dmesg_log} | grep -a -e 'Out of memory: Killed process' -e 'oom_reaper: reaped process' -e 'oom-kill:constraint=CONSTRAINT_NONE' -e 'Memory cgroup out of memory: Killed process' -e 'oom-kill:constraint=CONSTRAINT_MEMCG' | tee /dev/stderr | grep -q .",

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 broadens the old host-global heuristic into an unscoped CONSTRAINT_MEMCG / Memory cgroup out of memory match, but this job still just dumps the host dmesg buffer and does not clear or scope it to the current clickhouse-serv. A stale memcg kill from an earlier container on the same runner will now make oom_result fail here, which sets status = ERROR and skips FuzzerLogParser, so a real dead-server finding is relabeled as synthetic OOM in dmesg.

integration_test_job.py had to scope memcg OOM parsing for exactly this reason. Please key the memcg case to this run's server (task=clickhouse-serv / this container's cgroup) or clear/window dmesg before accepting CONSTRAINT_MEMCG.

@alexey-milovidov alexey-milovidov self-assigned this Sep 19, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 19, 2026
Merged via the queue into ClickHouse:master with commit f357fa8 Sep 19, 2026
178 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 19, 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-own-pr PR origin: CI on a groeneai PR exposed a separate defect 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