-
Notifications
You must be signed in to change notification settings - Fork 377
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(guided remediation): reduce memory footprint by computing dependency subgraphs instead of chains #1538
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1538 +/- ##
==========================================
+ Coverage 69.18% 69.31% +0.12%
==========================================
Files 200 200
Lines 18989 19038 +49
==========================================
+ Hits 13138 13196 +58
+ Misses 5141 5135 -6
+ Partials 710 707 -3 ☔ View full report in Codecov by Sentry. |
Any statistics about how much memory usage improves? |
For a particularly gnarly |
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.
LGTM
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.
awesome optimization!
Guided remediation had been using
DependencyChains
to track paths to a vulnerable package (for computing things like depth and which direct dependencies to relax). It was computing every possible path in the graph to a dependency, which grows roughly exponentially with depth / connectivity. This was using an unreasonable amount of memory on some particularly large/complex projects.I've changed the logic to instead compute one
DependencySubgraph
- the set of nodes and edges that would contain every path to a dependency. This should significantly reduce memory usage (and cpu usage from allocs) when running on larger projects.This change has touched quite a few places in the code, and the logic is a bit complex. I've tried my best to check that everything still behaves as expected.