qemu, build: bound the busybox and kernel fetches #27

Merged
noah merged 1 commits from rb/lc2-fix-1588 into rebuild 2026-10-23 04:35:53 -06:00
Owner

Bounds the two unbounded curl fetches used by CI (flare-edge #1588).

Why

flare-edge #1545, QEMU UI gate build (run 7391, job 63953, attempt 3): "Fetch pinned QEMU BusyBox" showed the curl progress header for busybox.net and then nothing for 15 minutes until the job's 30 minute timeout. qemu_get_busybox ran curl --retry 3 --retry-delay 5 --retry-connrefused -fSL with no connect timeout, stall limit or total cap, so a connection that opens and goes silent never ends and nothing retries. build/fetch-kernel-tarball.sh had the same curl, and also wrote straight to the destination, so a failed fetch left a partial tarball that the next run took as present and rejected on its sha256.

Change

File Change
qemu/lib.sh per attempt: abort below 1 KiB/s for 20 s, connect timeout 20 s, cap 60 s; curl retries once, the 3-attempt loop stays; BB_FETCH_STALL_SECS, BB_FETCH_MAX_SECS, BB_FETCH_RETRY_DELAY override for tests
build/fetch-kernel-tarball.sh connect timeout 20 s, abort below 10 KiB/s for 30 s, cap 600 s, retry 2; download to a temp file, rename on success
qemu/tests/busybox-fetch.sh new case: real curl against a local listener that sends headers and 5 bytes, then stalls
tests/fetch-kernel-tarball/ new suite: bounded argv, no partial file after a failure, refetch after a failure, reuse of a matching tarball
.github/workflows/ci.yml runs both suites; shellcheck covers the new one

Local gate

$ bash qemu/tests/busybox-fetch.sh            # before the lib.sh fix
FAIL: a stalled download hung instead of failing (60s)
$ time bash qemu/tests/busybox-fetch.sh       # after (3 more runs: 0 0 0)
busybox fetch tests passed
real 0m9.187s
$ bash tests/fetch-kernel-tarball/run-fetch-kernel-tarball-tests.sh   # before
[FAIL] curl carries --connect-timeout / --speed-limit / --speed-time / --max-time
[FAIL] failed fetch: no partial tarball left
[FAIL] run after a failed fetch downloads again and passes (FATAL: tarball sha256 mismatch)
exit=1
$ bash tests/fetch-kernel-tarball/run-fetch-kernel-tarball-tests.sh   # after
9 x [PASS]
fetch-kernel-tarball tests passed
$ shellcheck -x qemu/lib.sh qemu/tests/*.sh build/*.sh tests/fetch-kernel-tarball/*.sh
(clean)

Once this merges, a flare-edge rebuild submodule bump carries it (Fixes #1588 there).

Generated with Claude Code

https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG

Bounds the two unbounded curl fetches used by CI (flare-edge #1588). ## Why flare-edge #1545, QEMU UI gate build (run 7391, job 63953, attempt 3): "Fetch pinned QEMU BusyBox" showed the curl progress header for busybox.net and then nothing for 15 minutes until the job's 30 minute timeout. `qemu_get_busybox` ran `curl --retry 3 --retry-delay 5 --retry-connrefused -fSL` with no connect timeout, stall limit or total cap, so a connection that opens and goes silent never ends and nothing retries. `build/fetch-kernel-tarball.sh` had the same curl, and also wrote straight to the destination, so a failed fetch left a partial tarball that the next run took as present and rejected on its sha256. ## Change | File | Change | |---|---| | qemu/lib.sh | per attempt: abort below 1 KiB/s for 20 s, connect timeout 20 s, cap 60 s; curl retries once, the 3-attempt loop stays; `BB_FETCH_STALL_SECS`, `BB_FETCH_MAX_SECS`, `BB_FETCH_RETRY_DELAY` override for tests | | build/fetch-kernel-tarball.sh | connect timeout 20 s, abort below 10 KiB/s for 30 s, cap 600 s, retry 2; download to a temp file, rename on success | | qemu/tests/busybox-fetch.sh | new case: real curl against a local listener that sends headers and 5 bytes, then stalls | | tests/fetch-kernel-tarball/ | new suite: bounded argv, no partial file after a failure, refetch after a failure, reuse of a matching tarball | | .github/workflows/ci.yml | runs both suites; shellcheck covers the new one | ## Local gate ``` $ bash qemu/tests/busybox-fetch.sh # before the lib.sh fix FAIL: a stalled download hung instead of failing (60s) $ time bash qemu/tests/busybox-fetch.sh # after (3 more runs: 0 0 0) busybox fetch tests passed real 0m9.187s $ bash tests/fetch-kernel-tarball/run-fetch-kernel-tarball-tests.sh # before [FAIL] curl carries --connect-timeout / --speed-limit / --speed-time / --max-time [FAIL] failed fetch: no partial tarball left [FAIL] run after a failed fetch downloads again and passes (FATAL: tarball sha256 mismatch) exit=1 $ bash tests/fetch-kernel-tarball/run-fetch-kernel-tarball-tests.sh # after 9 x [PASS] fetch-kernel-tarball tests passed $ shellcheck -x qemu/lib.sh qemu/tests/*.sh build/*.sh tests/fetch-kernel-tarball/*.sh (clean) ``` Once this merges, a flare-edge rebuild submodule bump carries it (Fixes #1588 there). Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
noah added 1 commit 2026-10-23 00:24:01 -06:00
qemu, build: bound the busybox and kernel fetches
ci / kernel-symbols (push) Successful in 7m23s
ci / bench (pull_request) Successful in 31s
ci / mcdc (pull_request) Successful in 38s
ci / patches-apply (pull_request) Successful in 59s
ci / kernel-symbols (pull_request) Successful in 5m20s
ci / bench (push) Successful in 34s
ci / patches-apply (push) Successful in 1m6s
ci / qemu-tools (push) Successful in 2m37s
ci / prune-artifacts (push) Skipped
ci / kernel-build (push) Skipped
ci / prune-artifacts (pull_request) Skipped
ci / kernel-build (pull_request) Skipped
ci / qemu-tools (pull_request) Successful in 2m46s
ci / test (push) Successful in 40s
ci / mcdc (push) Successful in 33s
ci / test (pull_request) Successful in 43s
ci / quality (push) Successful in 1m56s
ci / badges (push) Skipped
ci / quality (pull_request) Successful in 1m27s
ci / badges (pull_request) Skipped
44b96074ed
qemu_get_busybox and fetch-kernel-tarball.sh ran curl with no connect
timeout, stall limit or total cap. A server that answered and then went
silent held the flare-edge QEMU UI gate build job until its 30 minute
timeout, with no retry (flare-edge #1588, run 7391 job 63953).

- qemu/lib.sh: each attempt gives up below 1 KiB/s for 20 s, or after
  60 s in all; curl retries once, the 3-attempt loop stays. Limits are
  overridable through BB_FETCH_* for the tests.
- build/fetch-kernel-tarball.sh: 20 s connect timeout, abort below
  10 KiB/s for 30 s, 600 s cap. The download lands in a temp file and is
  renamed on success, so a failed fetch no longer leaves a partial
  tarball that the next run takes as present and rejects on its sha256.
- Tests: busybox-fetch.sh serves a stalling local HTTP endpoint to the
  real curl (hung for the full 60 s guard before, fails in about 9 s
  after); new tests/fetch-kernel-tarball suite (bounded argv, no partial
  file, refetch after a failure, reuse of a matching tarball; 6 of 9
  checks red before). Both wired into CI and shellcheck.

Refs blueflare/flare-edge#1588

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
noah merged commit d279bc4c9f into rebuild 2026-10-23 04:35:53 -06:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blueflare/bfe-core1106-sdk#27