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 a possible panic on cache #3670

Merged
merged 1 commit into from
Feb 24, 2023
Merged

Conversation

imeoer
Copy link
Contributor

@imeoer imeoer commented Feb 24, 2023

newDesc.Annotations = nil
for _, k := range addAnnotations {
  newDesc.Annotations[k] = desc.Annotations[k]
}

The codes may cause buildkitd panic: assignment to entry in nil map

@imeoer
Copy link
Contributor Author

imeoer commented Feb 24, 2023

We encountered 1-5 panics per 30,000 builds, it's related to lzay layer with image ref annotation.

Copy link
Member

@jedevc jedevc left a comment

Choose a reason for hiding this comment

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

Nice catch 🎉

I think we want to make sure that the annotations map doesn't contain an empty map - it should either contain elements, or be nil.

@imeoer
Copy link
Contributor Author

imeoer commented Feb 24, 2023

Nice catch 🎉

I think we want to make sure that the annotations map doesn't contain an empty map - it should either contain elements, or be nil.

Thanks for the reply, fixed.

```
newDesc.Annotations = nil
for _, k := range addAnnotations {
  newDesc.Annotations[k] = desc.Annotations[k]
}
```

The codes may cause buildkitd panic: assignment to entry in nil map

Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
@jedevc jedevc merged commit 30eb659 into moby:master Feb 24, 2023
@tonistiigi tonistiigi mentioned this pull request Feb 28, 2023
@crazy-max crazy-max added this to the v0.11.4 milestone Feb 28, 2023
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.

None yet

3 participants