Repository navigation
Follow the kernel log for the whole integration test run instead of snapshotting a wrapped buffer - #117199
Conversation
The integration test job clears the kernel ring buffer at the start and reads it back at the end. Nothing bounds the buffer in between, and the job's own container churn logs several kernel lines per veth pair, so it wraps every few minutes while the job runs for over an hour. Measured on three red `Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6)` runs on 2026-08-30: the uploaded `dmesg.log` covered 7m47s of a 103-minute run, 4017 of its 4017 retained lines were veth or bridge churn, and the memcg OOM kill that ended the run was logged 42 minutes before the earliest retained line. All three runs printed `No kernel memory kill in dmesg`, and reported neither a leaf breach nor an unattributable one, on runs where the kernel had killed a ClickHouse server. So every dmesg-derived verdict in this job was being evaluated on the last few minutes of the run while `dmesg_cleared` reported the buffer as authoritative, and the negative was structurally unreachable rather than merely unlucky. The code that interprets the kernel record is unchanged. `MEMCG_OOM_OWNER`, `dind_leaf_oom_in_dmesg`, `job_cgroup_oom` and `leaf_oom_report` already know how to name the breaching cgroup; they were never fed a buffer containing the kill. This starts `dmesg -T --follow` immediately after the clear and gives every detector `follow + snapshot`. The union is a strict superset of the previous input, so no detector can lose a signal it had before. `--follow` prints the buffer it starts with before following, so the sub-second window between the clear and the start needs no marker, and the follower's own tail is covered by the terminal snapshot. Whether the record covers the run is derived from the follower still being alive, deliberately not from a timestamp or from the log file existing: a follower that died early leaves a file beginning exactly where a healthy one would, so either of those would reproduce this same defect one layer up. A dmesg-derived negative now says the record is partial when coverage is absent, and a missing or dead follower counts as uncovered, so the reporting fails closed. `dind_unreportable_ooms` takes that coverage instead of "the dump command succeeded". Its argument is renamed accordingly: the whole defect was a predicate promising something weaker than its consumer assumed, and a dump of an already-wrapped buffer satisfies the old one while holding none of the window a kill would be in. The two caveats ride opposite branches, because a buffer is unsound in opposite directions. An uncleared buffer holds a superset, so a kill it shows may be another job's while its silence still covers this run. A wrapped buffer holds a subset, so a kill it shows is this run's while its silence proves nothing. The follow log gets its own path because the hard-timeout `on_error_hook` truncates `./ci/tmp/dmesg.log`, and it is added to `set_files` so a hard-killed run uploads it too. One follower is started and stopped once, after the late scan; every run that starts one reaches that stop, since the only `complete_job` after the start is the final one. A run the runner hard-kills leaves it to die with the job's container. Container memory limits, worker sizing and `test_s3_plain_rewritable` itself are deliberately untouched: naming the breaching cgroup is what was missing, and choosing a capacity remedy is a separate question. The other clear-then-read sites under `ci/` share the pattern but were not measured to wrap, and no claim is made about them.
… start Review of the previous commit found three edges of the new capture lifecycle. Coverage was derived from the follower being alive alone. The follow log is read before that poll and with no drain barrier, so the records the follower has not consumed yet are not proven to be in it; the terminal snapshot is what covers that tail. Normally both are present, but when the snapshot fails the union collapses to the followed bytes while coverage still reported the record as spanning the run, and the honest `WARNING: no dmesg available` this path used to print became a bare `No kernel memory kill in dmesg`. Coverage is now a live follower and a successful snapshot, on all three paths that compute it. The weaker reading, "a successful snapshot instead", is not adopted: that is exactly the predicate the previous commit removed from `dind_unreportable_ooms`, since a dump of an already-wrapped buffer satisfies it. `ci/tmp` is git-ignored, so `_pre_run`'s `git clean -ffd` leaves its contents for the next job on the same runner. `start_dmesg_follow` truncates the follow log, but it is not called when the clear fails, and the readers, the two attaches and the `on_error_hook`'s `set_files` could then take a previous job's kernel record for this run's. The `dmesg_cleared` gates keep it out of every result row, so no verdict was wrong, but the hard-timeout diagnostics printed its kill lines and the artifact was attributed outright. The file already carries `clear_rabbitmq_recreation_scan_inputs` for this exact class, whose docstring states the rule: anything left in `temp_path` by an earlier job counts as an event of this one. The log is unlinked at job start instead of in that helper, which runs after the follower is started and would delete a live file. `print_timeout_diagnostics` claimed its only caller ran when the clear had succeeded. It does not: the hard-timeout path calls it whatever the clear did. That inference is deleted and the clear state is passed in, so the positive branch on the one path that never qualified it now carries the same caveat the end-of-run path has. An empty snapshot is read as a failed one there, because `Shell.get_output` returns an empty string for a failure and for a genuinely empty buffer alike; the conflation over-warns, which is the safe direction. `stop_dmesg_follow` no longer waits a second time after `SIGKILL`. It runs one statement before `report_rabbitmq_recreations` and two before `complete_job`, and `Result.update_sub_result` matches by name and silently keeps the placeholder, so a `TimeoutExpired` there would cost the run every row this change exists to produce. `SIGKILL` needs no confirmation. The first wait stays: it is what makes an ordinary stop observable and what reaps the child. The `Popen` in `start_dmesg_follow` only reports that the fork happened, so a `sudo` or `dmesg` that exits immediately was reported as a healthy follower. It now waits before polling, as `start_docker_in_docker` does before trusting its daemon. A refusal slower than that is still caught, because coverage polls the process again where the record is read. The comment justifying the overlapping lines in the union claimed every consumer returns a set or a boolean. `print_oom_lines` is a consumer and renders one line per match, so a kill still inside the snapshot's window is printed twice in the job log. That is the accepted cost of not deduping, not an absent effect: `-T` has one-second resolution, so deduping by line would merge two genuine kills in the same second. No result row can be duplicated, because the rows are built from the set-valued and boolean detectors.
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 2 rounds, 4 findings) plus my own
Recorded limitation rather than a claim: four arms assert on the source text instead of running Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20260830-211000 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20260830-204100 |
|
Workflow [PR], commit [e4853aa] Summary: ✅ AI ReviewSummaryThis PR replaces the single end-of-run Final Verdict✅ No actionable findings on the current PR head. |
|
cc @leshikus, could you review this? The integration test job clears the kernel ring buffer at job start and reads it back about 100 minutes later, but the job's own container churn wraps the buffer every few minutes, so a memcg OOM that killed a server was reported as |
5656824
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Related: #117104, the diagnostics half.
The integration test job clears the kernel ring buffer at the start and reads it back at the end.
Nothing bounds it in between: the job's container churn logs several kernel lines per veth
pair, wrapping it every few minutes while the job runs for over an hour.
Measured on three red
Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6)runs on2026-08-30 (report):
the uploaded
dmesg.logheld 7m47s of a 103-minute run, 4017 of 4017 lines were veth churn, andthe OOM kill happened 42 minutes before its earliest retained line. All three printed
No kernel memory kill in dmesgand reported no leaf breach: false-cleans on runs where a server was killed.The code that interprets the record is unchanged; it was never fed a buffer holding the kill.
This starts
dmesg -T --followafter the clear and feeds every detectorfollow + snapshot. Theunion is a strict superset of today's input, so no detector can lose a signal it has now. Coverage
is derived from the follower still being alive, and a negative says so when the record does not
cover the run. A missing or dead follower counts as uncovered, so this fails closed, and
dind_unreportable_oomsnow takes coverage rather than "the dump succeeded", which a wrappedbuffer also satisfies. Runs whose kill fell outside the retained window now show the red row
they should have.
Container limits, worker sizing and
test_s3_plain_rewritableare unchanged: naming the breachingcgroup is what was missing; capacity is a separate question. The other clear-then-read sites in
ci/lack this job's container churn.Verified on the real wrapped artifact: the existing detector names
Container memory budget exceeded (/docker)once the kill is in the union.Workflow [PR]
Sync PR [sync-upstream/pr/117199]
Version info
26.9.1.408(included in26.9and later)