This repository has been archived by the owner on Jun 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 task
knqyf263
suggested changes
Nov 29, 2021
pkginfoInZip, err := a.analyzeEggZip(content) | ||
if err != nil { | ||
return nil, xerrors.Errorf("egg analysis error: %w", err) | ||
} | ||
content = pkginfoInZip | ||
r = bytes.NewReader(pkginfoInZip) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
analyzeEggZip should return io.Reader
analyzer/analyzer.go
Outdated
Comment on lines
201
to
206
defer func() { | ||
err := cleaner() | ||
if err != nil { | ||
log.Logger.Warn("Clean temp directory error: %s", err) | ||
} | ||
}() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this defer will be called many times for the same file and it causes an error possibly. We have to be careful about when we call cleaner()
.
analyzer/analyzer.go
Outdated
} | ||
wg.Wait() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What made you add this here? It looks problematic.
This seems like an important improvement. Any timeline for this? |
masahiro331
force-pushed
the
feat/walk_process
branch
from
December 19, 2021 14:58
eaeda71
to
7f2bf58
Compare
knqyf263
changed the title
Improve FileOpener with walker package
fix(analyzer): improve performance
Dec 23, 2021
knqyf263
approved these changes
Dec 23, 2021
1 task
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix the following issue
aquasecurity/trivy#1295
aquasecurity/trivy#1284
Description
This pull request modifies the walker implementation to improve the amount of memory with some analyzers.
For Filesystem command case
If the file size is large
If the file size is small, read the file only once
For Image command case
When the file size is large
If the file size is small, read the file only once