-
Notifications
You must be signed in to change notification settings - Fork 536
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
High memory consumption when cataloging images with many files #2159
Comments
Hi @akpsgit, thanks for this detailed report. We will put it in our backlog for investigation as soon as we can! |
Hello @willmurphyscode, thanks a lot for the update. I Modified the profiling gist to work with the new code from v1.4.1 based on the example from https://github.com/anchore/syft/blob/main/examples/create_simple_sbom/main.go: looks like there is still a memory consumption peak at around 800 MB right at the end of SBOM generation for both versions:
|
@willmurphyscode, can we please reopen it? |
Thanks for the reproduction steps -- yeah, we can keep diving on this 👍 |
What happened:
While running an anchore/syft container in k8s with a 1GB memory limit, I noticed that it was killed on OOM while calculating the SBOM for the following demo image:
public.ecr.aws/ciscoeti/apa/bestbags-delivery@sha256:a560bdbb72f563b4be354f414aa812d442a9c1a0527d6687f95f67c8c57a65bc
Created a simple go binary to profile syft package cataloging to understand what causes the high memory consumption:
https://gist.github.com/akpsgit/bc14660363f3217c9df8d1e8900076cf
Got the following memory peak towards the end of cataloging:
From lookin at the memory graph of
go tool pprof -http=:8080 ./20230920165704-mem.prof
:In use space:
Allocated space:
looks like the issue might be related to the file tree squash or the mimetype DetectReader().
From looking at the image content to see what special about it that can explain the high consumption, looks like it has ~40K files, which can explain the high usage in tree squash and mimetype DetectReader.
What you expected to happen:
Steps to reproduce the issue:
go tool pprof -http=:8080 ./20230920165704-mem.prof
Anything else we need to know?:
Might be related:
gabriel-vasile/mimetype#354
Environment:
syft version
:cat /etc/os-release
or similar):K8s kind, MacOS
The text was updated successfully, but these errors were encountered: