Skip to content

AST fuzzer: install core_dump.yaml so cores are not capped at 1 GiB - #113991

Merged
azat merged 2 commits into
ClickHouse:masterfrom
groeneai:fuzzer-install-core-dump-yaml
Aug 9, 2026
Merged

azat merged 2 commits into
ClickHouse:masterfrom
groeneai:fuzzer-install-core-dump-yaml

Conversation

@groeneai

@groeneai groeneai commented Aug 8, 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: #113835

Cores uploaded by AST fuzzer (*) are truncated, so the server death a core was collected for cannot be root-caused. Measured on core.QueryPipelineEx.126-2991 from AST fuzzer (arm_asan_ubsan) on #100371: 8358039552 bytes present against 46038720512 declared by the core's own program headers (18.2%), with 1694 of 1740 data-carrying PT_LOAD segments entirely past EOF. All 4 arm_asan_ubsan occurrences in the last 30 days are truncated.

Root cause: 41df48368639d6c centralized the CI RLIMIT_CORE override into tests/config/config.d/core_dump.yaml and deleted this script's inline core.xml (100 GiB), but never added the new file to configure()'s copy list. The fuzzer does not run tests/config/install.sh, so nothing installs it and Server.cpp's 1 GiB default applies.

A 1 GiB cap yields a multi-GiB file because RLIMIT_CORE bounds emitted bytes while seeks over absent pages advance the offset for free, which is exactly an ASAN address space. I reproduced that shape locally: at a fixed 1 GiB cap, logical sizes of 9.0 GiB and 33.0 GiB with written bytes pinned at ~1073741824, so one fixed cap explains four different non-round observed sizes.

534b8fab3a59f7ab fixed the same defect, with the same symptom description, for jobs that do run install.sh. The AST fuzzer was missed because it hand-copies configs.

Validated by asserting the effective limit on the server process, replaying the shipped configure() copy list: Max core file size is 1073741824 at HEAD and 107374182400 with this change.

Two notes. The next genuine fuzzer core is the first end-to-end confirmation; the cap is proven sufficient to explain the cores I measured, not yet observed absent. Separately, 41df48368639d6c also deleted sysctl kernel.core_pattern='core.%e.%p-%P' and nothing sets it now; the observed names still match only because the container is privileged and the sysctl is host-global. I am leaving that out of this change.

Version info

  • Merged into: 26.8.1.1026 (included in 26.8 and later)

Cores uploaded by AST fuzzer (*) are truncated, so the server death a core
was collected for cannot be root-caused. Measured on
core.QueryPipelineEx.126-2991 from AST fuzzer (arm_asan_ubsan) on ClickHouse#100371:
8358039552 bytes present against 46038720512 declared by the core's own
program headers (18.2%), with 1694 of 1740 data-carrying PT_LOAD segments
entirely past EOF, including the faulting thread's stack. All 4 occurrences
in the last 30 days are truncated. Not a download or decrypt artifact: the
zstd frame verifies and declares the short size, and the S3 Content-Length
matches the bytes fetched, so the kernel never wrote the tail.

41df483 centralized the CI RLIMIT_CORE override into
tests/config/config.d/core_dump.yaml and deleted this script's inline
core.xml (100 GiB), but never added the new file to configure()'s copy list.
The fuzzer does not run tests/config/install.sh, and the <core_dump> block in
programs/server/config.xml ships commented out, so nothing installs it and
Server.cpp's 1 GiB default applies. The setrlimit succeeds; the value is just
wrong.

A 1 GiB cap still yields a multi-GiB file because RLIMIT_CORE bounds emitted
bytes while seeks over absent pages advance the offset for free, which is
exactly the shape of an ASAN address space. Reproduced locally: at a fixed
1 GiB cap, logical sizes of 9.0 GiB and 33.0 GiB with written bytes pinned at
about 1073741824, so one fixed cap explains four different non-round observed
sizes.

534b8fa fixed the same defect, with the same symptom description,
for the jobs that do run install.sh. The AST fuzzer was missed because it
hand-copies configs. Use the centralized file rather than restoring the
inline XML, so this completes that centralization instead of reverting it.

Verified by asserting the effective limit on the server process while
replaying the shipped configure() copy list: Max core file size is
1073741824 before this change and 107374182400 after, with no
"Cannot set max size of core file" warning in either case.

41df483 also deleted sysctl kernel.core_pattern='core.%e.%p-%P' and
nothing sets it now. The observed core names still match that pattern only
because the container is privileged and the sysctl is host-global. That is
left out of this change.

Related: ClickHouse#113835
The fuzzer jobs' digest_config.include_paths is the only way praktika learns
what a job reads. Without the new file listed, a later change to the
centralized 100 GiB limit does not move the jobs' digest, so the run can be
served from cache and the change never reaches the fuzzer.

The per-file form keeps the blast radius at one file rather than rebuilding
these jobs on every commit that touches tests/config, following
./tests/config/users.d/ci_logs_sender.yaml which the ClickBench job lists for
the same reason.
@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (3 gate rounds + 2 cold reviews, 1 fix round; 3 AGREE / 1 DISAGREE / 5 nits)

Each round is an independent cold review of the resulting code plus a separate second-model pass.
Findings are adjudicated against measurements, not prose. The reviewer never edits the code; fixes
go back to a separate implementation step.

Round 1 (0 blockers, 2 majors, 4 nits)

  • ⚠️ major: the new core_dump.yaml dependency is absent from the fuzzer jobs' cache digests, so a
    later change to the centralized limit could be served from cache and never reach the fuzzer. I
    first dismissed this as pre-existing, since configure() already copies eight other
    tests/config files that are equally undigested. That was wrong on its own terms: this commit is
    what creates this file's dependency, so the gap is introduced here. My other objection, that the
    remedy would have to be the coarse ./tests/config entry and would rebuild the fuzzer jobs on 200
    of the last 200 master commits touching that tree, is answered by an exact in-tree precedent I had
    missed: ci/defs/job_configs.py names the single file tests/config/users.d/ci_logs_sender.yaml
    for the ClickBench job, which hand-copies that one file the same way. Fixed in the second
    commit: the one file is added to all three fuzzer digests, verified to make each job's digest move
    when the yaml changes, with a pre-fix control that does not move, and verified not to fire for
    install.sh or listen.xml, which is what proves a file was added and not the directory.
  • ❌ DISAGREE, major, on one sub-remedy: "add a shipped test that fails if the copy is reverted."
    Two grounds. First, this exact test was refused: @ Algunenano asked twice to delete
    ci/tests/test_install_sh_fast_limits.py on Fix the dead is_fast_build check so limits_fast.yaml is actually installed on Fast test #112387 ("Please remove this test, it's useless"),
    and bb14a17f93f4944 removed it. That test asserted precisely that a CI config install is wired
    up, and the merged fix for this same defect on the sibling path (534b8fab3a59f7ab) shipped one
    insertion and no test. Second, the suggested form is worse than the defect: a prlimit assertion
    inside run-fuzzer.sh, which runs under set -e -u -o pipefail, turns a config regression into a
    startup failure of the job whose purpose is to survive a 30-minute fuzz run. The wider ask, for
    proof that the copy actually raises the limit, is AGREEd and answered in the description: the
    effective limit read off the server child is 1073741824 before and 107374182400 after, same
    binary, with no Cannot set max size of core file warning in either arm. I re-verified that the
    pre-fix arm of that measurement is byte-identical to the parent commit's script and that it
    replays the real copy list, 12 lines against 13, rather than a paraphrase; the surviving
    preprocessed configs corroborate independently, with no live numeric size_limit without the file
    and 107374182400 with it. No existing test is weakened either: the one in-tree core-limit test
    supplies its own config and is independent of both files this PR touches.
  • 💡 nit: the visible Related: line used the #113835 shorthand where the template asks for full
    GitHub URLs. Fixed. Nothing parses those lines, so this is style.
  • 💡 nit (mine): the container's hard RLIMIT_CORE had never been checked, and the server sets
    only the soft limit. If the hard limit were below 100 GiB the setrlimit would fail behind a
    warning and this change would be inert. Closed: setrlimit cannot fail when the soft limit is
    under the hard one, the hard limit is unlimited in this container class, the job passes no
    --ulimit core, and a stateless job that already installs this file uploaded a core far larger
    than 1 GiB compressed, so the raised cap is demonstrably reachable in CI.
  • 💡 nit (mine): with the cap raised the kernel writes roughly 43 GiB instead of 8, so I checked
    whether the teardown could now SIGKILL a dump in progress. It cannot. The kernel finishes the
    dump before the process is reapable, so the liveness probe cannot see a refused connection until
    the dump is complete; in the cited job log the probe fails, clickhouse stop returns within a
    second, and only then does the runner find a complete file. The escalation ladder needs at least
    70 seconds and was never reached.
  • 💡 nit (mine): eight other tests/config files that configure() copies are still undigested.
    Genuinely pre-existing and unaffected by this change, with no observed consequence. Noted, not
    fixed here.

Round 2 (0 blockers, 2 majors, 0 nits): the two majors above, restated. The digest one came
back unchanged, which is what moved me off my own DISAGREE; the proof one was restated as an
evidence ask with explicit closing criteria rather than a shipped test, and those criteria are what
the description now reports. The Related: nit was gone, confirming that fix. One fix round
followed.

Round 3 (0 findings): full re-review after the digest fix, against the final description.
Nothing new raised.

My own cold review of the final tree re-derived the root cause from source before reading any of
the implementation's notes, and rebuilt the carrier list by asking who executes run-fuzzer.sh
rather than by checking the plan: one direct invocation in ast_fuzzer_job.py, plus BuzzHouse
reaching the same code by importing run_fuzz_job, giving exactly the three job definitions that
are patched, with no fourth in any workflow. Sibling core collectors were checked individually
rather than assumed out of scope: the stress, upgrade, stateless and fast-test paths install this
file through tests/config/install.sh and so were already fixed by 534b8fab3a59f7ab, and
ClickBench cannot upload a core at all because it collects logs with the core-collecting branch
disabled. One nit of my own: the description said "all 4 occurrences" under a sentence scoped to
AST fuzzer (*), where the 4 is the arm_asan_ubsan count and the wildcard reading gives 8. Fixed
in the description before it was finalized, and round 3 ran against the corrected text.

Also checked and found benign: #111934 edits this same script but not configure()'s copy list, so
there is no conflict. Its 180-second core-collection bound is justified in a comment against "a
1 GiB core"; the number stays adequate, since a full core compresses in well under a minute on
measurement, but that wording goes stale once this merges, so whichever lands second should reword
it.

@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Start a server from the shipped configure() copy list and read the limit off the server process: grep 'Max core file size' /proc/<server-pid>/limits. At HEAD it is 1073741824 every time. The truncation shape itself is deterministic too: a test program that maps a sparse region and touches more than the cap produces a core whose headers declare far more than EOF, at a fixed 1 GiB cap.
b Root cause explained? Yes. 41df48368639d6c moved the CI RLIMIT_CORE override into tests/config/config.d/core_dump.yaml and deleted this script's inline core.xml (100 GiB), but never added the new file to configure()'s copy list. The fuzzer does not run tests/config/install.sh, so nothing installs it and Server.cpp's 1 GiB default applies. RLIMIT_CORE bounds emitted bytes, and seeks over absent pages are free, so on an ASAN address space the kernel stops at 1 GiB written while the program headers still declare the full span.
c Fix matches root cause? Yes. The defect is a missing config install and the fix is that install, using the centralized file the same commit introduced. Not a detector, not a stop-path change, not a widened bound. ulimit -c in the script would be inert because the server sets its own limit at startup.
d Test intent preserved / new tests added? No test shipped, matching 534b8fab3a59f7ab, the merged fix for this identical defect on the install.sh path, which was also one line with no test. No existing test is weakened.
e Both directions demonstrated? Yes, on the effective limit rather than the file copy. Replaying the shipped configure() copy list, Max core file size is 1073741824 with the HEAD script and 107374182400 with this change, and no Cannot set max size of core file warning appears in either. My first probe read the watchdog process instead of the server child and returned unlimited for both arms; the agreeing arms were the tell that the probe, not the change, was wrong.
f Fix is general across code paths? Yes. BuzzHouse shares this configure(), so it is fixed by construction. Jobs running tests/config/install.sh are already correct via 534b8fab3a59f7ab, and the clickhouse_proc.py servers start from those installed configs. Integration tests own their config plumbing and are out of scope.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A. CI config install, no query inputs or type wrappers.
h Backward compatible? Yes. CI-only, no settings history entry, no server behavior change, no change to which artifacts are uploaded.
i Invariants and contracts preserved? Yes. The invariant is that every CI server able to produce a core runs with a core_dump.size_limit large enough to hold it. The added cp targets a file that always exists in the repo, so it cannot abort a run under set -e, and --dereference matches the neighboring copies. The 100 GiB limit means a genuinely large dump is now written in full, which is the intended cost. I checked the interaction with the 180s core-collection deadline proposed in #111934, which is described against a 1 GiB core: measured here, zstd --threads=0 compresses 1 GiB of incompressible bytes in under a second, so even a ~43 GiB core stays far inside that bound.

Session id: cron:clickhouse-review-slot-9:20260808-221400

@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

cc @Algunenano, could you review this? It is the same defect you fixed in 534b8fa, on the one path that does not run tests/config/install.sh: run-fuzzer.sh hand-copies its configs and never picked up the centralized core_dump.yaml, so the AST fuzzer has been running at the 1 GiB default and its cores are truncated.

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

clickhouse-gh Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f5f77c2]

Summary: ✅


AI Review

Summary

This PR wires tests/config/config.d/core_dump.yaml into run-fuzzer.sh and adds that file to the cache digests of every job that reaches the shared fuzzer runner (AST fuzzer, targeted AST fuzzer, and BuzzHouse). I reviewed the current PR head diff and file contents, the prior PR discussion, and the Praktika report for #113991, and I did not find a correctness, rollout, or cache-invalidation gap in the current change set.

Final Verdict

No new inline findings.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 9, 2026
@groeneai

groeneai commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - f5f77c2

CI is fully finished and clean on this head: 175 check-runs, 0 queued/in_progress, Config Workflow
and Finish Workflow both green, Mergeable Check and CH Inc sync green, last check completed
2026-08-09T08:38:24Z. By conclusion: 16 success, 159 skipped, and zero with any other conclusion.

Check / test Reason Owner / fixing PR
none no failures on this commit not applicable

The high skip count is the expected job selection for this diff, not a dropped run: the change
touches only ci/defs/job_configs.py and ci/jobs/scripts/fuzzer/run-fuzzer.sh, so praktika
scheduled the fuzzer family plus the always-on checks. All 6 BuzzHouse (*) and all 5 AST fuzzer (*) jobs, CI Tests, Style check, Build profile diff and Code Review ran and passed, which is
exactly the set that exercises the touched paths. CIDB reports 0 FAIL/ERROR rows for this commit
sha at the sub-result level.

Session id: cron:our-pr-ci-monitor:20260809-090000

@azat
azat added this pull request to the merge queue Aug 9, 2026
Merged via the queue into ClickHouse:master with commit ebc17b0 Aug 9, 2026
180 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 9, 2026
@groeneai groeneai added the groeneai-origin-request PR origin: a maintainer pinged or directed groeneai label Aug 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 groeneai-origin-request PR origin: a maintainer pinged or directed groeneai 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.

4 participants