Shared-layer lifecycle: accounting, eviction, recovery, materialization - #458
Shared-layer lifecycle: accounting, eviction, recovery, materialization#458chruffins wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 33c8ca3. Configure here.
| info, statErr := os.Stat(dirPath) | ||
| if statErr != nil || info.ModTime().After(cutoff) { | ||
| continue | ||
| } |
There was a problem hiding this comment.
Eviction can wipe in-flight layers
Medium Severity
Layer eviction decides freshness from the digest directory ModTime, and it runs concurrently with materialization. Unpack and mkfs.erofs write inside child temp dirs, so the parent mtime goes stale; DeleteImage can then RemoveAll that tree while a build is still using it, especially during the later unlocked ExportRootfs window before the manifest is written.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 33c8ca3. Configure here.
| if result.CacheHit { | ||
| cacheStatus = "hit" | ||
| } | ||
| m.recordImageBuildPhase(ctx, ref.Digest(), "layer_materialization", time.Since(materializeStart), "success", cacheStatus) |
There was a problem hiding this comment.
Layer bytes skipped after failed builds
Medium Severity
Materialized layer artifacts are written to the layer store before conversion, but refreshDiskUsageTotals only runs on successful finalize, delete, or startup. After a failed conversion the artifacts remain on disk while TotalImageBytes keeps the stale cached total, so capacity admission undercounts the real footprint.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 33c8ca3. Configure here.
41f4080 to
35de95e
Compare
35de95e to
f9a5fcc
Compare
d9caa0e to
b0a27b4
Compare
b0a27b4 to
37b8128
Compare
37b8128 to
13adf76
Compare
13adf76 to
c0e6c32
Compare
c0e6c32 to
aac8b57
Compare
aac8b57 to
7464627
Compare
4467fe9 to
588fff8
Compare
ac3de8e to
165e42f
Compare
165e42f to
3cac19c
Compare
8ca57c1 to
419c294
Compare
c238f03 to
5051c46
Compare
3cf0501 to
10f5e38
Compare
10f5e38 to
9cbf5fb
Compare
466f089 to
0fa6aa6
Compare
78e404c to
0e1b801
Compare
0e1b801 to
888f303
Compare
888f303 to
197ed4c
Compare
197ed4c to
72814fb
Compare
e6597bd to
fe533bb
Compare
fe533bb to
962f4d2
Compare
962f4d2 to
2250812
Compare
2250812 to
3787792
Compare
Materializes each manifest layer after a pull so sharing degrades instead of failing the build. Artifacts unreferenced by any manifest model are evicted, protected by a grace period and by in-flight references held until the referencing model is durable. Startup sweeps stale staging directories and orphans left by an unclean shutdown. Evictions are counted as hypeman_images_layer_artifacts_evicted_total.


summary
Capstone stage of the image-storage project — finishes migration, eviction, accounting, recovery, and observability on the shared-layer path.
images/layers/<digest>/(best effort; the composed rootfs still comes from blobs, so an artifact failure is logged and only degrades sharing)..unpack-*/.install-*/.tag-stage-*temp directories are swept at startup (age-gated so live builds are untouched).TotalOCICacheBytesbucket alongside OCI blobs, soCurrentImageStorageBytes(ready rootfs + cache/layers) counts them exactly once and capacity admission sees the real footprint.hypeman_images_layer_artifacts_evicted_totalcounter plus slog eviction summaries and per-layer materialization warnings.validation
TOOMANYREQUESTS).main.rebase and follow-up hardening
Rebased onto the current composition and layer-artifact stack. The lifecycle caller now uses the manager's probed native-artifact capability, so Linux-root hosts whose layer-store filesystem lacks
mknodor trusted overlay xattrs take the merged-rootfs fallback instead of repeatedly attempting native materialization.