Repository navigation
cache: make in-use pruning opt-out and guard DiskUsage against pruned parents - #34
Merged
Merged
Conversation
… parents A size-bounded prune --all may remove a record that still has live refs, including a parent whose only refs are its child records. The next DiskUsage then dereferences a nil entry for the missing parent and the daemon crashes with SIGSEGV. Guard the parent rescan in DiskUsage so a missing parent is skipped, and put the in-use pruning behavior behind a new worker.oci pruneInUse toml key. It defaults to true so existing users of prune --keep-storage keep their current behavior; setting it to false restores upstream leaf-first semantics where records with refs are never prune candidates. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
piob-io
marked this pull request as ready for review
September 2, 2026 18:46
bruce-y
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
buildkitdSIGSEGV atcache/manager.goDiskUsagethat fires after abuildctl prune --all --keep-storage Nreclaimed anything, without changing what that prune does for existing--keep-storageusers.Root cause. #29 lets
pruneOncepick records withlen(cr.refs) > 0whenall && keepBytes != 0. A parent layer's only refs are usually the structurallayerParentrefs of its children, so a size prune can remove a parent while the children survive.DiskUsagerebuilds the graph fromcm.recordsand doesm[p].refs--for each child's parent without checking the parent is still there → nil deref. Upstream never hits it because upstream prune only ever removes leaves (len(cr.refs) == 0).Changes
DiskUsage: skip parents missing fromminstead of dereferencing nil.worker.ocitoml keypruneInUse(default true = today's behavior) plumbedconfig.OCIConfig.PruneInUse → base.WorkerOpt.PruneInUse → cache.ManagerOpt.PruneInUse; the containerd worker hardcodestrue.pruneOncebecomespruneInUse = falserestores upstream leaf-first semantics (records with refs are never candidates; chains collapse bottom-up acrossprune()iterations).TestPruneKeepStorageInUseDiskUsage(parent+child chain, size prune removes the in-use parent,DiskUsagemust not panic — reproduces the production SIGSEGV without the guard) andTestPruneKeepStorageLeafFirst(pruneInUse=falseremoves the child only).Default stays on so
setup-docker-builder@v1users ofmax-cache-size-mb(which relies on the #29 behavior with GC disabled) are unaffected;setup-docker-builder@release/v2will writepruneInUse = falsesince it runs with GC enabled and never needs in-use pruning.cachepackage tests:TestMergeOpfails identically onmasterin this environment (size assertion, filesystem-dependent); everything else passes.Link to Devin session: https://app.devin.ai/sessions/5c8deaae10f14cf49877e6f03ff873f9
Open in Devin Desktop: https://app.devin.ai/desktop/session/5c8deaae10f14cf49877e6f03ff873f9?variant=devin
Requested by: @piob-io
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled. (Staging)