lua: splited to listener and route filter for memory spikes#9368
lua: splited to listener and route filter for memory spikes#9368zirain wants to merge 7 commits into
Conversation
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
a330657 to
16e373a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a330657c66
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
c4a1e4a to
ad3785a
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #9368 +/- ##
==========================================
+ Coverage 75.33% 75.38% +0.04%
==========================================
Files 252 252
Lines 41471 41570 +99
==========================================
+ Hits 31243 31337 +94
+ Misses 8115 8113 -2
- Partials 2113 2120 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9e1e5ca to
9b269cb
Compare
|
Is this finding legitimate? [High] Listener-level Lua leaks onto routes claimed by a more-specific non-Lua policy — internal/xds/translator/lua.go:169-171 if irRoute.EnvoyExtensions == nil || len(irRoute.EnvoyExtensions.Luas) == 0 { Trigger:
Result: R runs the gateway Lua it should have overridden. Pre-PR this couldn't happen (gateway Lua was applied per-route and the same line-708 guard kept it off R). So it's a genuine regression. What makes it more than a one-liner: routes that legitimately should inherit the gateway Lua (no route policy → gateway loop sets r.EnvoyExtensions = {ExtProcs,Wasms,DynamicModules}, Luas nil at line 717) are indistinguishable in the IR from R at patchRoute time — both have EnvoyExtensions != nil and Luas == nil. The listener-Lua design dropped the "this route was excluded by precedence" signal, so the fix needs to re-introduce that distinction (e.g. mark precedence-excluded routes in the IR), not just tweak the if. |
good catch. |
|
Once this is merged please ping me or cherry-pick yourself to 1.8 branch |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2513fdaa16
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
2513fda to
843a8c1
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 843a8c153a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c8dc11cf79
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe6ae4ee69
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ExtProcs: extProcs, | ||
| Wasms: wasms, | ||
| DynamicModules: dynamicModules, | ||
| FromGatewayPolicy: new(true), |
There was a problem hiding this comment.
Replace invalid bool allocation
This gateway-policy path now uses new(true), but Go's new operand must be a type rather than a value, so any build of internal/gatewayapi after this commit fails before tests can run. Use an existing bool-pointer helper such as ptr.To(true) or assign true to a local bool and take its address.
Useful? React with 👍 / 👎.
- Added a Luas field to the listener-level EnvoyExtensions struct so listener-scoped Lua policies can be represented separately from per-route ones. - Refactored to add HCM placeholder filters for both per-route Lua slots and listener-level Lua filters (using named Lua HCM filters with empty default source). Listener filters are appended after route-slot filters to preserve ordering after HCM filter reversal. The Disabled: true flag was removed from listener Lua HCM filters since they are always active for the listener. - New implementation that injects listener-level Lua source code and filter context into RouteConfiguration.TypedPerFilterConfig, delivering script changes via RDS to avoid listener drains. Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
…on-Lua policy Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
fe6ae4e to
4854bf6
Compare
Fixes: #9355
RouteConfigurationVirtualHost.TypedPerFilterConfig, delivering script changes via RDS to avoid listener drains.With this patch, for envoy that has a listener with ~1000 routes, the memory cost reduce from 1GB to 120MB.
TODO: add stats check after envoyproxy/envoy#45871 merged.