Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check snapshot labels to avoid panic #4187

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

goller
Copy link
Contributor

@goller goller commented Aug 29, 2023

I saw a panic while using the stargz snapshotter caused by the labels being nil.

My wild-guess as to why labels is nil is that the stargz snapshotter could not find a bolt bucket:

https:/containerd/containerd/blob/b0a7f08aa7490a3d43787b9f2b444e4b20b96f8c/metadata/boltutil/helpers.go#L53

I saw a panic while using the stargz snapshotter caused
by the labels being nil.

This adds a check to prevent the panic.

Signed-off-by: Chris Goller <[email protected]>
@tonistiigi tonistiigi requested a review from ktock August 30, 2023 16:34
@@ -1099,8 +1099,10 @@ func (sr *immutableRef) prepareRemoteSnapshotsStargzMode(ctx context.Context, s
if err == nil { // usable as remote snapshot without unlazying.
defer func() {
// Remove tmp labels appended in this func
for k := range tmpLabels {
info.Labels[k] = ""
if info.Labels != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add a debug log saying snapshot already exists but tmp remote labels are nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @ktock!

Added in 395e72c

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

PTAL @ktock

@tonistiigi tonistiigi merged commit 83b1db2 into moby:master Sep 14, 2023
55 checks passed
@goller goller deleted the fix/stargz-label-panic branch September 14, 2023 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants