Skip to content

container/prune: Don't fail early on layer size errors#52090

Merged
thaJeztah merged 1 commit intomoby:masterfrom
vvoland:fix-prune-rwlayerusage
Feb 25, 2026
Merged

container/prune: Don't fail early on layer size errors#52090
thaJeztah merged 1 commit intomoby:masterfrom
vvoland:fix-prune-rwlayerusage

Conversation

@vvoland
Copy link
Contributor

@vvoland vvoland commented Feb 24, 2026

When ContainerPrune calls GetContainerLayerSize, the container's RW layer snapshot may have already been removed by a concurrent operation.

This causes GetContainerLayerSize to return a "rw layer snapshot not found" error, which previously aborted the entire prune operation.

The layer size is only calculated for informational purposes so it's not worth failing the whole prune operation anyway.

- What I did

- How I did it

- How to verify it

- Human readable description for the release notes

Fix `docker system prune` failing with "rw layer snapshot not found" when a container is concurrently removed

- A picture of a cute animal (not mandatory but encouraged)

@vvoland vvoland added this to the 29.2.2 milestone Feb 24, 2026
@vvoland vvoland self-assigned this Feb 24, 2026
@vvoland vvoland added impact/changelog area/daemon Core Engine kind/bugfix PR's that fix bugs labels Feb 24, 2026
@vvoland vvoland force-pushed the fix-prune-rwlayerusage branch from 82969f6 to b062af3 Compare February 24, 2026 16:06
daemon/prune.go Outdated
Comment on lines +73 to +74
// Log error as warning, the size is only for informational purposes
log.G(ctx).Warnf("failed to get layer size for container %s: %v", c.ID, err)
Copy link
Member

Choose a reason for hiding this comment

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

Should / can we gate this by a "IsNotFound" check?

Perhaps the remove below as well (but not 100% sure about that one)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about this and no - the size is just for informational purposes, we should just carry on.

In this case, other errors are probably related to the overall system health/data integrity so they would pop up somewhere else anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also for the other one, just because there was issue with one container it shouldn't fail the whole prune operation.

Copy link
Member

Choose a reason for hiding this comment

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

oh, sorry, meant mostly for the logging; don't print scary warnings if it's an expected situation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah perhaps could be a "Debug" log only, but also this shouldn't probably be happening so often...

@vvoland vvoland force-pushed the fix-prune-rwlayerusage branch from b062af3 to 6b9ed34 Compare February 25, 2026 10:47
When ContainerPrune calls GetContainerLayerSize, the container's RW
layer snapshot may have already been removed by a concurrent operation.

This causes GetContainerLayerSize to return a "rw layer snapshot not
found" error, which previously aborted the entire prune operation.

The layer size is only calculated for informational purposes so it's not
worth failing the whole prune operation anyway.

Signed-off-by: Paweł Gronowski <[email protected]>
@vvoland vvoland force-pushed the fix-prune-rwlayerusage branch from 6b9ed34 to 2ac82f4 Compare February 25, 2026 11:16
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah merged commit b8c132f into moby:master Feb 25, 2026
245 of 248 checks passed
raghavkaul added a commit to raghavkaul/moby that referenced this pull request Feb 25, 2026
container/prune: Don't fail early on layer size errors
@vvoland vvoland modified the milestones: 29.2.2, 29.3.0 Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running "docker stop" on an ephemeral container and then calling "docker system prune" causes "rw layer snapshot not found for container" error

2 participants