Skip to content

Split libFuzzer corpus minimization into its own weekly workflow - #117145

Merged
qoega merged 1 commit into
masterfrom
libfuzzer-split-minimization
Aug 31, 2026
Merged

qoega merged 1 commit into
masterfrom
libfuzzer-split-minimization

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 30, 2026 •

Copy link
Copy Markdown
Member

Every nightly libFuzzer tests run first minimizes each corpus with libFuzzer's -merge=1, which replays every unit to find the subset that preserves coverage, and only then starts fuzzing. That is a fixed amount of work proportional to the corpus, and it is taken out of the same budget the target then has left. In the 2026-08-30 run it cost clickhouse_fuzzer 38 minutes and execute_query_fuzzer 25 minutes; those two targets are already the ones that never reach mutation. Meanwhile the corpora it produced were 10845 units out of 10931 and 4436 out of 4445 - about 1% removed, for work that is repeated in full every single night.

Minimization now runs in a new WeeklyFuzzersCorpus workflow on Sunday at 13:13 UTC, and the nightly job always runs with SKIP_MERGE=1. The two workflows both read-modify-write the corpora in the artifact bucket, so the schedule is chosen to keep them apart: NightlyFuzzers starts at 03:13 UTC and is long finished by then.

The check script grows a --minimize-only mode for the new job: it minimizes, uploads the result and reports the reduction, with no fuzzing phase. Corpus minimization results now also count towards the OK total in the job summary, which otherwise would read OK: 0 for the minimization job.

Related: #117143
Related: #117142

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

Version info

  • Merged into: 26.9.1.461 (included in 26.9 and later)

Every nightly `libFuzzer tests` run first minimizes each corpus with
libFuzzer's `-merge=1`, which replays every unit to find the subset that
preserves coverage, and only then starts fuzzing. That is a fixed amount of
work proportional to the corpus, and it is taken out of the same budget the
target then has left. In the 2026-08-30 run it cost `clickhouse_fuzzer` 38
minutes and `execute_query_fuzzer` 25 minutes; those two targets are already
the ones that never reach mutation. Meanwhile the corpora it produced were
10845 units out of 10931 and 4436 out of 4445 - about 1% removed, for work
that is repeated in full every single night.

Minimization now runs in `WeeklyFuzzersCorpus` on Sunday at 13:13 UTC, and the
nightly job always runs with `SKIP_MERGE=1`. The two workflows both
read-modify-write the corpora in the artifact bucket, so the schedule is
chosen to keep them apart: `NightlyFuzzers` starts at 03:13 UTC and is long
finished by then.

The check script grows a `--minimize-only` mode for the new job: it minimizes,
uploads the result and reports the reduction, with no fuzzing phase.
Corpus minimization results now also count towards the `OK` total in the job
summary, which otherwise would read `OK: 0` for the minimization job.
@clickhouse-gh

clickhouse-gh Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [41f990f]

Summary: ✅


AI Review

Summary

This PR splits libFuzzer corpus minimization out of the nightly job into a new weekly workflow and adds a --minimize-only path to the existing check script and runner. The direction is reasonable, but the current wiring still introduces an unsynchronized second writer for the shared corpus and leaves the new runner-side behavior outside the libFuzzer job cache key, so I do not think it is ready to merge as-is.

Findings

⚠️ Majors

  • [.github/workflows/weekly_fuzzers_corpus.yml:7-10] The new workflow writes the same fuzzer/corpus/*.zip objects as NightlyFuzzers, but the only coordination is cron spacing. Scheduled workflows also expose workflow_dispatch, and concurrency.group: ${{ github.workflow }} only serializes runs within the same workflow. A delayed nightly run or a manual dispatch on master can overlap the weekly minimization, and whichever upload finishes last will silently discard the other run's corpus updates. Use a cross-workflow lock or shared concurrency group for the corpus read-modify-write.
  • [ci/defs/job_configs.py:1847] The new MINIMIZE_ONLY behavior lives partly in tests/fuzz/runner.py, but the digest for both libFuzzer jobs hashes only ci/jobs/libfuzzer_test_check.py. Because libfuzzer_test_check.py bind-mounts tests/ and executes tests/fuzz/runner.py, a follow-up commit that changes only the runner can reuse a stale cached success and skip the corpus job entirely. Add ./tests/fuzz/runner.py to the digest, and mirror the same change in libfuzzer_job.
Final Verdict

⚠️ Changes requested.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 30, 2026
Comment on lines +7 to +10
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}

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 still leaves the corpus with two unsynchronized writers. Generated schedule workflows also expose workflow_dispatch, and concurrency.group: ${{ github.workflow }} only serializes WeeklyFuzzersCorpus with itself, not with NightlyFuzzers. Since both workflows do a full download / mutate / upload of the same fuzzer/corpus/*.zip keys, a delayed nightly run or a manual dispatch on master will race here and the last upload wins, dropping the other run's corpus updates. This needs a cross-workflow lock or shared concurrency group around the corpus read-modify-write, not just separated cron slots.

Comment thread ci/defs/job_configs.py
),
requires=[ArtifactNames.ARM_FUZZERS, ArtifactNames.FUZZERS_CORPUS],
digest_config=Job.CacheDigestConfig(
include_paths=["./ci/jobs/libfuzzer_test_check.py"],

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.

libfuzzer_test_check.py bind-mounts repo_path/tests and executes /usr/share/clickhouse-test/fuzz/runner.py, but this digest only hashes ./ci/jobs/libfuzzer_test_check.py. A follow-up commit that changes only tests/fuzz/runner.py can therefore reuse a stale cached success and skip this job even though its behavior changed. Please include at least ./tests/fuzz/runner.py in this digest, and mirror the same fix in libfuzzer_job above.

id: run
run: |
. ./ci/tmp/praktika_setup_env.sh
PYTHONUNBUFFERED=1 python3 -m praktika run 'Dockers Build (amd)' --workflow "WeeklyFuzzersCorpus" --ci --timestamp

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.

It is strange that we can't just use the latest build from master and rebuild it again.

@qoega
qoega added this pull request to the merge queue Aug 31, 2026
@qoega

qoega commented Aug 31, 2026

Copy link
Copy Markdown
Member

It will not be triggered in PR CI anyway so we need to check the real one on Sunday.

Merged via the queue into master with commit 13b015f Aug 31, 2026
178 checks passed
@qoega
qoega deleted the libfuzzer-split-minimization branch August 31, 2026 19:45
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 31, 2026
alexey-milovidov added a commit that referenced this pull request Sep 2, 2026
…n job

After #117145 the nightly fuzzing run sets `SKIP_MERGE=1` and corpus
minimization runs in the weekly `libFuzzer corpus minimization` job, so
the `MINIMIZATION_TIMEOUT` plumbing in `tests/fuzz/runner.py` no longer
has anything to bound. The minimize-only job now simply gets the one-hour
cap through `TIMEOUT`, keeping its behavior unchanged while the fuzzing
job moves to five hours.

The job timeout drops from seven to six hours, because the fuzzing job no
longer contains a minimization phase. Six hours does not exceed GitHub's
default limit, so the generated `nightly_fuzzers.yml` does not change,
which also fixes the `Check Workflows` failure:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=117143&sha=8f63aa320e7dc99a472dddd42707fbe8108d57d0&name_0=PR&name_1=Config%20Workflow
#117143
alexey-milovidov added a commit that referenced this pull request Sep 2, 2026
…_ARTIFACT_BUCKET`

Master (#117145) made `main` read `args.minimize_only`, while this branch had
dropped the `args` binding as unused, so the textually clean merge would have
raised `NameError`. It also moved the corpus location to
`Settings.S3_ARTIFACT_BUCKET`; the orphan-corpus warning now names the same bucket.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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