Skip to content

tests: Cap oci-delta's bsdiff size in the switch-from-delta test - #13

Closed
jmarrero-bot wants to merge 1 commit into
mainfrom
bot/delta-test-memory
Closed

jmarrero-bot wants to merge 1 commit into
mainfrom
bot/delta-test-memory

Conversation

@jmarrero-bot

@jmarrero-bot jmarrero-bot commented Nov 6, 2026 •

Copy link
Copy Markdown

plan-51-switch-from-delta can fail on composefs UKI with oci-delta create "terminated by SIGKILL" (seen on bootc-dev#2623). The guest kernel OOM-kills oci-delta in the 4G test VM, which has no swap: the rebuilt UKI (~122 MiB) is under oci-delta's default 192 MiB bsdiff limit, and tar-diff's bsdiff needs ~16 bytes per byte of the old file. Capping bsdiff at 64 MiB in the test makes oci-delta use rollsums for the UKI, with a delta of about the same size.

Testing, on a 16-core RHEL 10 devspace, image built like CI's fedora-44 composefs xfs systemd uki unsealed job, plan in bcvk's default 4G/2 vCPU VM:

  • In the test VM, oci-delta peaks at 2.3-2.4 GiB of anonymous memory (CI's killed process was at 3.5 GiB); with --max-bsdiff-size 64 at 100-140 MiB, in ~72 s instead of ~170 s, and the delta is 3.35 MB instead of 3.42 MB. --jobs 1 doesn't lower the peak.
  • The failure is rare on main (10/10 plan runs passed, in CI this is the only oci-delta SIGKILL in this job since 2026-10-14) because how far the Go heap overshoots depends on GC timing. With GOGC=200 in the test environment, main failed 2/2 exactly like CI and this branch passed 2/2. Even with GOGC=off oci-delta stays at 1.07 GiB with the cap.
  • This branch: plan-51-switch-from-delta passed 4/4 at 1a2fa13, which differs from the current head only in comment wording (plus 8/8 at an earlier revision, also differing only in a comment).

Measurements and run details: https://gist.github.com/jmarrero-bot/cef85960bc80160278b2440ebb86d112

Related: bootc-dev#2623

Generated-by: https://github.com/jmarrero-bot#llms


Review draft in jmarrero-forge, not upstream yet. This section is removed when the PR is opened upstream.

  • Upstream: bootc-dev/bootc, base main
  • Board item: PVTI_lADOFBIZ7c4BlZPrzhGl-zU
  • Fork CI: off; the devspace testing described above is this PR's CI, and upstream CI runs once it is opened there

To review:

  • Approve, or comment /promote on a line of its own, to open it upstream, ready for review. Either covers only the commits pushed so far.
  • If upstream requires DCO, approving also signs off: promote adds Signed-off-by: Joseph Marrero Corchado <[email protected]> to the commits lacking it (the bot's and yours; anyone else's only if you ask), with you as committer.
  • Add a /draft line (in the same comment or before) to open it upstream as a draft (/ready undoes that).
  • Close to drop it.
  • Edit the title and description freely: they become the upstream PR's. Review comments are squashed into the commits they concern, with a reply here.

Bot run: session 77cad178, agent a52e51aa · claude-opus-5-5 22.3M in (89% cached) / 66k out · ~$17.07 inference + ~$5.26 compute (est., list prices) · 2h 10m wall · 33.4 core-h, Actions run 42239475447

@jmarrero-bot jmarrero-bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: ship as-is. Reviewed head 1a2fa133 against c3be5244; no blocking findings.

Optional wording nit — tmt/tests/booted/test-switch-from-delta.nu:67: “Above the cap it uses rollsums” is conditional in tar-diff v0.6.1: rollsum matches must exceed 20%; otherwise it copies the file content. Consider “Above the cap this UKI uses rollsums.” The UKI-specific claims in the commit message and PR body are consistent with the measurements.

The root cause checks out: the CI artifact confirms a global guest OOM kill, no swap, and anon-rss:3641696kB. oci-delta v0.3.1 depends on tar-diff v0.6.1, defaults to bsdiff with a 192 MiB cap, and converts the new flag from MiB to bytes. The cap checks both old and new file sizes. bsdiff allocates two (old size + 1) int arrays, approximately 16 bytes per old byte on this 64-bit job, plus input buffers and other heap overhead. The recorded GOGC experiments support the GC explanation without establishing the exact GC state of the failed CI run.

The test remains meaningful: it removes the target image, switches from the delta, verifies staged and booted digests, checks the marker after reboot, and runs fsck. The measured ~3.35 MB delta retains useful binary-delta coverage. Recorded devspace testing (4/4 at this head and 2/2 with GOGC=200, versus 2/2 failures on main with GOGC=200) is adequate for this test-only change; the PR body agrees with the linked gist.

Commit hygiene passes: one scoped commit, imperative subject and why-body, bot author/committer, Generated-by: AI, no sign-off or fixup commits. bot-git check and git diff --check passed locally. No builds or tests were run for this review.

@jmarrero-bot jmarrero-bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review guide for head 1a2fa13304: where to look closely and what is safe to skim. It is advice from the bot's reviewer and doesn't replace reading the diff; the review app walks it.

Test-only change: plan-51-switch-from-delta passes --max-bsdiff-size 64 to oci-delta create so the ~122 MiB rebuilt UKI goes through tar-diff's rollsum path instead of bsdiff, whose suffix sort allocates two []int arrays the size of the old file (~16 bytes per byte, ~2 GiB here) and got oci-delta OOM-killed in CI's 4 GiB swapless VM. The root cause checks out against tar-diff v0.6.1 (bsdiff.go, diff.go generateForFile) and CI's console.txt (global OOM, 1046979 pages RAM, swap 0, oci-delta anon-rss 3641696 kB). The delta stays tar-diff format v1 (binary-diff is still bsdiff), the 16 MB composefs .dump still goes through bsdiff, and rollsums emit only ops bootc's oci-delta 0.1.1 crate applies, so the test still exercises a real binary delta. Risk is low: the flag first shipped in oci-delta 0.3.1, which is what Fedora 44/45/46 ship, and the test is Fedora-only with F43 disabled. The only things to read closely are the wording of the new comment and the memory figure in the commit message and PR body (CI's anon-rss is 3.47 GiB, not 3.6G).

Hotspots

  1. note · logic — tmt/tests/booted/test-switch-from-delta.nu:61-68 (1a2fa13): Accurate overall, but one []int comes from bsdiff() and the other from qsufsort, so it is not only qsufsort. Rollsums are used only when more than 20% of the blocks match (diff.go generateForFile); otherwise the UKI is copied whole. The test would still pass in that case, just with a much larger delta.

Safe to skim

  • tmt/tests/booted/test-switch-from-delta.nu:25-26: Constant used once, in the oci-delta call it documents

@jmarrero-bot
jmarrero-bot force-pushed the bot/delta-test-memory branch from 1a2fa13 to 7fe111d Compare November 6, 2026 17:13
@jmarrero-bot

Copy link
Copy Markdown
Author

Applied the wording fixes from both reviews in 7fe111d: the code comment now credits bsdiff and qsufsort and says the UKI goes through rollsums, and the commit message and body give CI's killed process as 3.5 GiB (3641696 kB) instead of 3.6G. Comment and message text only, so the devspace runs at 1a2fa13 still apply.

Generated-by: https://github.com/jmarrero-bot#llms

@jmarrero

jmarrero commented Nov 7, 2026

Copy link
Copy Markdown

/promote

plan-51-switch-from-delta can fail on composefs UKI with oci-delta
create "terminated by SIGKILL": the kernel OOM-kills it in the 4G test
VM, which has no swap. The target image rebuilds the UKI (~120 MiB),
which is under oci-delta's default 192 MiB bsdiff limit, and tar-diff's
bsdiff keeps two int arrays the size of the old file. In the test VM
that puts oci-delta at 2.3-2.4 GiB of anonymous memory, and it was at
3.5 GiB when it was killed in CI; how far above the live set it goes is
down to GC timing.

Capping bsdiff at 64 MiB makes oci-delta use rollsums for the UKI
instead. That brings its peak down to about 130 MiB and its run time
from ~170 to ~70 seconds, while the delta stays about the same size
(3.35 vs 3.42 MB), so the test still applies a real binary delta.
--jobs 1 does not help: only one layer has large files.

Generated-by: AI
Signed-off-by: Joseph Marrero Corchado <[email protected]>
@jmarrero-bot
jmarrero-bot force-pushed the bot/delta-test-memory branch from 7fe111d to 0379d6f Compare November 7, 2026 13:26
@jmarrero-bot

Copy link
Copy Markdown
Author

Signed off 1 commit(s) with Signed-off-by: Joseph Marrero Corchado <[email protected]> for bootc-dev/bootc's DCO check, on jmarrero's approval #13 (comment) of 7fe111d6a65a. Same trees; the head is now 555d9c24aaa5.

@jmarrero-bot

Copy link
Copy Markdown
Author

Opened upstream as bootc-dev#2635. Closing this review draft.

@jmarrero-bot jmarrero-bot moved this to Done in Workstream Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants