-
Notifications
You must be signed in to change notification settings - Fork 80
Fix memory leak in thread-local VM & plugin caches #357
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
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
f56438e to
14a90ba
Compare
064946b to
045acc3
Compare
|
@mpwarres @martijneken @kyessenov could you review this change and verify that it fixes the issue? Thanks! |
|
Yeah, the issue is real, I was aware of it. Generally LG. |
PiotrSikora
left a comment
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.
Could you split this PR in two? The SHA256 and cache cleanup are completely separate features, so it will speedup review and merging.
Sure, here you go -- #359 . This one's going to be all about key leak/cleanup. |
Since VM and plugin thread-local cache keys include volatile parts (namely VM configuration, code and plugin configuration), their reconfiguration/update (e.g. with Envoy ADS protocol) might lead to memory leak by leaving those thread-local map stale keys behind. The current cleanup method is insufficient, as it accounts only for cache hit case. Signed-off-by: Maxim Philippov <[email protected]>
55a1101 to
3befcf8
Compare
Signed-off-by: Maxim Philippov <[email protected]>
0440bb2 to
1586280
Compare
Signed-off-by: Maxim Philippov <[email protected]>
mpwarres
left a comment
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 mod minor comments. Thanks!
Signed-off-by: Maxim Philippov <[email protected]>
8f1ea93 to
315ae55
Compare
Signed-off-by: Maxim Philippov <[email protected]>
mpwarres
left a comment
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, thanks! @PiotrSikora and @kyessenov, does the current PR address your comments?
PiotrSikora
left a comment
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.
Any chance for a test, or is it hard to exercise?
Signed-off-by: Maxim Philippov <[email protected]>
Signed-off-by: Maxim Philippov <[email protected]>
There are a couple of calls to |
Adding testing-only functions to access cache state SGTM, thanks! |
PiotrSikora
left a comment
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, sans nits.
But I'd also like to hear from @kyessenov.
Sorry for delay. I'll think of something. Maybe I'll just move |
FWIW, my original ask was for a test that's broken (showing a leak) without this PR and fixed with this PR. Personally, I don't see too much value in unit testing |
kyessenov
left a comment
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.
LG, thanks for bounding it.
|
I'm good with this as-is. Thanks for the contribution! |
Since VM and plugin thread-local cache keys include volatile parts (namely VM configuration, code and plugin configuration), their reconfiguration/update (e.g. with Envoy ADS protocol) might lead to memory leak by leaving those thread-local map stale keys behind. The current cleanup method is insufficient, as it accounts only for cache hit case.
Also, plugin configuration is placed into cache key as is (by contrast with SHA256 hash for VM keys), which causes noticeable memory consumption when configuration is large.