Skip to content

libimage: do not fail disk usage when an image is removed mid-walk - #1073

Open
vtushar06 wants to merge 2 commits into
podman-container-tools:mainfrom
vtushar06:libimage-diskusage-removed-image
Open

libimage: do not fail disk usage when an image is removed mid-walk#1073
vtushar06 wants to merge 2 commits into
podman-container-tools:mainfrom
vtushar06:libimage-diskusage-removed-image

Conversation

@vtushar06

Copy link
Copy Markdown

podman system df flakes in parallel CI runs when another test removes an image while df is walking the list:

# $ podman system df --format {{"\n"}}
# Error: Image f995a32fc412 exists in local storage but may be corrupted (remove the image to resolve the issue): reading image "f995a32fc412...": locating image with ID "f995a32fc412...": image not known
# [ rc=125 ]

(from https://github.com/podman-container-tools/podman/actions/runs/29565253194/job/87336101705, and again on 07-21)

DiskUsage lists the images once, then diskUsageForImage calls isCorrupted per image, so anything removed between the two steps kills the whole command. Same shape as the volume flavor that 246724fc6 fixed on the podman side, just on the image path.

Two small changes: isCorrupted wraps with %w instead of %v so the error keeps its type, and DiskUsage skips an image only on ErrImageUnknown. A genuinely corrupted image still fails - TestCorruptedLayers builds the missing-layer case and it passes unchanged, which I checked matters here because that error is ErrLayerUnknown, not ErrImageUnknown.

The new test fails on the old code (require.ErrorIs cannot see image not known through the %v wrap) and passes with the fix. Ran both tests on linux in a container.

@github-actions github-actions Bot added the common Related to "common" package label Aug 12, 2026
Comment thread common/libimage/image.go
Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
@vtushar06
vtushar06 force-pushed the libimage-diskusage-removed-image branch from dca9ffc to 4544bf0 Compare August 13, 2026 16:30
@vtushar06

Copy link
Copy Markdown
Author

@giuseppe I think this will be ready, just waiting for workflow to pass out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to "common" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants