Skip to content

fix(ci): size the nightly fuzz batch to its timeout, fix the crashes it hid - #531

Merged
M0Rf30 merged 1 commit into
mainfrom
ci/fuzz-batch-budget
Nov 27, 2026
Merged

M0Rf30 merged 1 commit into
mainfrom
ci/fuzz-batch-budget

Conversation

@M0Rf30

@M0Rf30 M0Rf30 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Refs #514. The tracking issue stays open until a nightly run passes; the next passing run closes it.

Root causes (from the run logs)

1. Time, not a hang. The batch job was cancelled at its 120 min timeout on 11 of the last 16 nights (11-19, 11-21 to 11-27).

  • 204 targets, and ClusterFuzzLite gives each fuzz-seconds / targets = 17 s and counts nothing else. Per target, libFuzzer start/stop (~1.6 s), the corpus clone/fetch (~1.2 s) and the corpus upload by git commit + git push (~3 s) come on top: 23.6 s wall on average (23.57 / 23.78 / 23.67 s on 11-18 / 11-21 / 11-27, 33 s max). The Run fuzzers step takes ~80 min for a "1 hour" budget.
  • The Build fuzzers step took 14-31 min up to 11-11 and 34-56 min from 11-12 on, for the same 204 targets (runner CPU variance).
  • Setup + build + run ~ 1 + build + 80 min, so a build over ~38 min cancels the run. 11-18 passed with 35.8 + 81 = 117.3 min. 11-27 (job 140474670992): build 11:22:28-12:04:34 (42 min), run 12:04:34-13:22:10 (77.6 min), cancelled, SARIF upload skipped, annotation The job has exceeded the maximum execution time of 2h0m0s.
  • A cancelled run never uploads the crashes it found (upload_crashes() runs after the loop), and the report job ignored cancelled.

2. The 11-20 failure (run 44719092556, job 136229890096) was a different failure mode. The build was fine. The first thing Run fuzzers does, git clone of the storage repository, returned HTTP 403 six times (fatal: unable to access ... The requested URL returned error: 403, back-off 1/2/4/8/16 s), then Retrying on GitFilestore._clone failed and CalledProcessError ... exit status 128. The token check 35 min earlier had passed and prune cloned fine an hour later, so the 403 was transient. scripts/fuzz-issue.sh printed no crash lines found in the failed log because it only grepped crash patterns.

3. A real crash hid behind "Not reproducible" (FuzzMarshalRoundTrip, in every log since 11-11). The oracle demanded a round trip for any requirement, while DecodeSpecification rejects more than 64 clauses (maxSpecClauses, #421, the hostile-gemspec hardening of 11-04): rubymarshal: invalid data: 103 requirement clauses exceeds maximum 64. The failure message printed the specification with %+v, its string fields hold NUL bytes, and libFuzzer copies the message to the log only up to the first NUL. The Test unit written to line was lost with it, so ClusterFuzzLite re-ran a different file (Reproduce command returned: 0. Not reproducible) and passed the target.

I reproduced it with the exact OSS-Fuzz Go shim (go-118-fuzz-build, ASAN, the CI flags -jobs=4 -workers=4 -max_total_time=17 -len_control=0 and the stored corpus, 178 files): the old build crashed 9 of 12 jobs in three 17 s runs and exits 77 on the saved input; the new build ran 12 of 12 jobs clean and exits 0 on it. It is not a product bug: the decoder only runs on uploads, and the cap is deliberate. The oracle now asserts the cap, rubymarshal.MaxRequirementClauses is exported instead of duplicated, and the messages print %#v.

The same 11-21 set held two more crashes:

  • rubygems FuzzServeGemGet (gems/nokogiri-1.16.2-x86_64-linux.gem?;): the oracle did not strip the query string.
  • conda FuzzParsePackageIndex (117255555555555e5555): the oracle decoded numbers as float64. The oracle was wrong, but it pointed at a real bug: PostgreSQL jsonb refuses numbers beyond numeric (value overflows numeric format, 22003), so an upload with "platform": 1e131072 failed the INSERT with a 500. jsonbRefuses now drops such keys, like it already did for NUL. A differential run against PostgreSQL 18 with 20000 boundary literals found 0 accepted that jsonb refuses; the only difference was a harmless over-strict refusal of zero-valued numbers with absurd exponents.

All three have a seed under testdata/fuzz/ and a behaviour test (TestSpecificationRequirementClauseCap, TestPackageIndexJSONBNumbers); the seeds fail on the old oracle with the CI error text.

Changes

  • clusterfuzzlite-batch.yml: timeout 120 -> 180 min. A Start the clock step records the deadline, a Fuzz budget step gives the targets the time left (minus a 15 min reserve and 10 s overhead per target), at most the 3600 s of today, and fails fast naming the build when a target would get under 5 s. A normal night keeps the full 3600 s; a 110 min build gets ~6 s per target instead of being cancelled. A Wait for the storage repository step (git ls-remote, 20 tries x 30 s) outlasts the transient 403.
  • scripts/fuzz-issue.sh: a job that hit its timeout (annotation exceeded the maximum execution time) is a failure and updates the issue; a cancel by hand still changes nothing. The issue lists the failed jobs and steps and shows git errors, tracebacks and ::error:: lines. The report jobs of the batch and api-fuzz get checks: read.
  • scripts/fuzz-issue_test.sh, run in the CI job go: timeout, cancel by hand, the 11-20 failure, a crash, a silent failure, success. 13 checks fail against the old script.
  • docs/development/fuzzing.md: time budget, storage wait, issue rules, and the real artifact layout of the OSS-Fuzz shim (go-fuzz-headers; the page described another layout).

Checks

  • scripts/fuzz-issue_test.sh, shellcheck, actionlint on the three workflows: pass. The budget and wait steps were run with fake deadlines and a stub git (3600 s after a 43 and 56 min build, 1224 s after ~110 min, error at 60 and 25 min left, error with no targets, a flaky 403 recovers, a down storage fails).
  • go test -short ./pkg/rubymarshal/... ./internal/format/rubygems/... ./internal/format/conda/... and golangci-lint on them: pass.
  • The batch workflow is dispatched once on this branch (run link in a comment) to prove the job ends inside its timeout.

…it hid

Refs #514. The nightly `batch` job was cancelled at its 2 h timeout on 11 of the last 16 nights.

Timeout. 204 targets get 17 s each from ClusterFuzzLite, but start/stop, corpus clone and corpus push add ~6.6 s per target (23.6 s wall, 33 s max), so the run takes ~80 min for a 1 h budget. The build grew from 14-31 min to 34-56 min on 2026-11-12. Setup + build + run reached 120 min whenever the build took more than ~38 min (11-27: build 42 min, run 77.6 min, cancelled at target ~198 of 204). A cancelled run never uploads its crashes.
- Timeout 120 -> 180 min. A new `Fuzz budget` step gives the targets the time left until the timeout (minus 15 min and 10 s per target), at most 3600 s, and fails fast when a target would get under 5 s.
- A new `Wait for the storage repository` step outlasts a transient GitHub 403: on 2026-11-20 the clone returned 403 six times in 31 s and cifuzz gave up with exit 128.
- `scripts/fuzz-issue.sh`: a timed-out job (annotation `exceeded the maximum execution time`) is a failure and updates the issue; a cancel by hand still changes nothing. The issue lists the failed jobs and steps and shows git errors and tracebacks, not only crashes (11-20 said `no crash lines found`). `report` jobs get `checks: read`.
- `scripts/fuzz-issue_test.sh` runs in the CI job `go` (13 of its checks fail against the old script).

Crashes the nightly run reported or hid:
- rubygems `FuzzMarshalRoundTrip` (the recurring `Not reproducible` crash): the oracle demanded a round trip for any requirement, but `DecodeSpecification` rejects more than 64 clauses (#421). NUL bytes in the `%+v` failure message cut the log, so the crash file name was lost and ClusterFuzzLite re-ran another file. Reproduced with the OSS-Fuzz shim: the old build crashed 9 of 12 jobs in three 17 s runs and exits 77 on the saved input; the new build ran 12 of 12 jobs clean and exits 0. The oracle now asserts the cap; `rubymarshal.MaxRequirementClauses` is exported.
- rubygems `FuzzServeGemGet`: the oracle did not strip the query string.
- conda `FuzzParsePackageIndex`: the oracle read numbers as float64. The product bug behind it is real: PostgreSQL jsonb refuses numbers beyond numeric, so an upload with `"platform": 1e131072` failed the INSERT. `jsonbRefuses` now drops such keys like it drops NUL. Checked against PostgreSQL 18 with 20000 boundary literals: none accepted that jsonb refuses.
- docs/development/fuzzing.md: time budget, storage wait, issue rules, and the real artifact layout of the OSS-Fuzz shim (go-fuzz-headers).
@github-actions

Copy link
Copy Markdown

Coverage

Coverage vs main
Go, unit + integration 83.3% ±0.0
Go, unit tests only 69.7% ±0.0
Go, integration tests only 53.1% ±0.0
Web, lines 91.8% ±0.0
Web, functions 85.8% ±0.0
Go by area
Area Coverage vs main
cmd/docgen 80.3% ±0.0
cmd/genformats 90.8% ±0.0
cmd/oa 0.0% ±0.0
cmd/resetpw 0.0% ±0.0
cmd/server 70.2% ±0.0
internal/ai 85.6% ±0.0
internal/api 77.4% ±0.0
internal/apkkeys 77.1% ±0.0
internal/apktest 90.7% ±0.0
internal/artifactpath 100.0% ±0.0
internal/attest 84.0% ±0.0
internal/attestation 79.2% ±0.0
internal/audit 97.6% ±0.0
internal/auth 91.6% ±0.0
internal/backup 72.4% ±0.0
internal/bgtask 96.8% ±0.0
internal/blockreason 100.0% ±0.0
internal/branding 93.5% ±0.0
internal/bundlechecks 100.0% ±0.0
internal/clientsetup 93.0% ±0.0
internal/config 96.4% ±0.0
internal/cron 90.0% ±0.0
internal/crypto 91.0% ±0.0
internal/csaf 85.0% ±0.0
internal/curation 99.2% ±0.0
internal/database 76.1% +0.1
internal/declarative 84.1% ±0.0
internal/dtrack 85.3% ±0.0
internal/exploit 93.6% ±0.0
internal/federation 81.6% -0.1
internal/format 80.2% ±0.0
internal/formats 88.0% ±0.0
internal/gpgkeys 86.8% -0.3
internal/group 89.5% ±0.0
internal/httpcache 100.0% ±0.0
internal/httpcompress 93.3% ±0.0
internal/httpx 85.7% ±0.0
internal/imagesbom 81.9% ±0.0
internal/importmeta 93.3% ±0.0
internal/iocopy 100.0% ±0.0
internal/itempath 98.3% ±0.0
internal/lazyre 100.0% ±0.0
internal/license 98.5% ±0.0
internal/licensemeta 87.5% ±0.0
internal/licensepolicy 92.6% ±0.0
internal/limitio 92.9% ±0.0
internal/mcp 89.9% ±0.0
internal/metrics 96.2% ±0.0
internal/middleware 94.6% ±0.0
internal/netutil 93.4% ±0.0
internal/nixkeys 79.6% ±0.0
internal/oacli 85.2% ±0.0
internal/ocimanifest 100.0% ±0.0
internal/ocipath 100.0% ±0.0
internal/ociref 96.8% ±0.0
internal/osv 89.8% ±0.0
internal/passwd 93.3% ±0.0
internal/pathseg 100.0% ±0.0
internal/pglock 89.5% +10.5
internal/pkgdeps 88.1% ±0.0
internal/presign 99.2% ±0.0
internal/promote 84.5% ±0.0
internal/proxy 86.8% ±0.0
internal/publicurl 96.8% ±0.0
internal/pypisimple 97.9% ±0.0
internal/quarantine 100.0% ±0.0
internal/quayapi 81.2% ±0.0
internal/quota 92.2% ±0.0
internal/recovery 85.7% +0.5
internal/registry 100.0% ±0.0
internal/replication 78.2% +0.1
internal/repodispatch 85.1% ±0.0
internal/repotype 97.0% ±0.0
internal/rpmextra 92.9% ±0.0
internal/sbom 89.9% ±0.0
internal/scanexport 96.4% ±0.0
internal/search 90.5% ±0.0
internal/secrets 91.4% ±0.0
internal/storage 84.9% ±0.0
internal/telemetry 92.2% ±0.0
internal/tiering 83.5% ±0.0
internal/trash 96.7% ±0.0
internal/urlparams 100.0% ±0.0
internal/vexsync 80.0% ±0.0
internal/vuln 89.9% ±0.0
internal/webhook 86.1% ±0.0
internal/worker 82.7% ±0.0
internal/workq 79.5% ±0.0
pkg/ansible 89.8% ±0.0
pkg/cargo 95.6% ±0.0
pkg/compactindex 97.8% ±0.0
pkg/composer 94.5% ±0.0
pkg/conan 99.2% ±0.0
pkg/conda 94.8% ±0.0
pkg/delta 71.4% ±0.0
pkg/gemversion 100.0% ±0.0
pkg/helm 97.0% ±0.0
pkg/lockfile 96.7% ±0.0
pkg/logger 96.9% ±0.0
pkg/maven 96.7% ±0.0
pkg/nix 99.1% ±0.0
pkg/npm 88.0% ±0.0
pkg/nuget 97.6% ±0.0
pkg/pyversion 100.0% ±0.0
pkg/rubymarshal 87.1% ±0.0
tests/integration 78.8% ±0.0
web 93.7% ±0.0
Web by area (lines)
Area Coverage vs main
src 85.1% ±0.0
src/api 92.8% ±0.0
src/components 90.2% ±0.0
src/composables 89.7% ±0.0
src/demo 93.0% ±0.0
src/i18n 98.5% ±0.0
src/lib 99.2% ±0.0
src/pages 92.1% ±0.0
src/pwa 97.6% ±0.0
src/router 98.6% ±0.0
src/stores 99.0% ±0.0
src/telemetry 90.8% ±0.0

Full report (HTML, merged profile) in the CI run artifacts

@M0Rf30

M0Rf30 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

Batch workflow dispatched on this branch to prove the job ends inside its timeout: https://github.com/openartifact/openartifact/actions/runs/46039173202 (result in a follow-up comment).

@M0Rf30
M0Rf30 merged commit 8500b63 into main Nov 27, 2026
25 of 26 checks passed
@M0Rf30
M0Rf30 deleted the ci/fuzz-batch-budget branch November 27, 2026 17:37
@M0Rf30 M0Rf30 mentioned this pull request Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant