Repository navigation
Report the fuzzer jobs' host OOM as a named result again - #116359
Conversation
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.
Internal second-model review (click to expand)Three review rounds, each a cold read of the tree plus an independent second-model pass.
Ten mutations of the new code each redden a distinct subset of the tests, and renaming the |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20260825-114100 |
|
cc @leshikus, could you review this? A CI report refactor dropped the named |
|
Workflow [PR], commit [577ab1a] Summary: ✅ AI ReviewSummaryThis PR restores the named Findings
Final VerdictChanges requested. |
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]>
| # 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( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 toname="":test_oom_in_dmesg_appends_named_sub_resultandtest_named_oom_child_survives_to_job_resultfail."OOM in dmesg"dropped fromSYNTHETIC_TEST_NAMES:test_a_host_oom_row_is_not_investigated_and_does_not_count_as_a_runfails.
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.
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.
| # `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 .", |
There was a problem hiding this comment.
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.
Related: #108689
Changelog category (leave one):
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*)andBuzzHouse (amd_debug)reported a bare job-levelerrorwith an emptytest_name. Every per-test CIDB query filterstest_name != '', so the row washidden: 35 rows across 22 pull requests over 90 days, each exactly the
19-byte
ERROR: OOM in dmesg.Commit
6a8fa92277b0d2fcaused it, replacing this branch'sResult.from_commands_run(name="OOM in dmesg", ...)with a bareinfo.append(...);CIDBClienttakestest_namefrom 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
dmesgdump 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_MEMCGand
Memory cgroup out of memory: Killed process, whose lowercaseout of memorythe existing capital-O pattern cannot match. While it missed,FuzzerLogParserfell through toServer unresponsive: memory limit exceeded,named from whichever
Code: 241was last in the server log, that is, abystander 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 dmesginstead of the misattributed name, sorevert_ci_regressions.pyreadsit 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, andnothing executes that directory, so a file there could not redden. I can add one
to
ci/tests/test_e2e.pyif wanted.Workflow [PR]
Sync PR [sync-upstream/pr/116359]
Version info
26.10.1.234-master(included in26.10and later)