-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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: the issue that plugins in global rule may be cached to route #4867
Conversation
apisix/init.lua
Outdated
@@ -694,7 +694,7 @@ function _M.http_log_phase() | |||
end | |||
|
|||
core.ctx.release_vars(api_ctx) | |||
if api_ctx.plugins and api_ctx.plugins ~= core.empty_tab then | |||
if api_ctx.plugins and core.table.nkeys(api_ctx.plugins) > 0 then |
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.
Empty plugins also need to be released.
apisix/plugin.lua
Outdated
@@ -307,7 +307,7 @@ function _M.filter(conf, plugins, route_conf) | |||
trace_plugins_info_for_debug(nil) | |||
-- when 'plugins' is given, always return 'plugins' itself instead | |||
-- of another one | |||
return plugins or core.empty_tab | |||
return plugins or {} |
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.
return plugins or {} | |
return plugins or core.tablepool.fetch("plugins", 0, 0) |
t/node/global-rule.t
Outdated
|
||
|
||
|
||
=== TEST 17: delete global rules, ensure no stale data remain |
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.
bad title, need to more detail
What this PR does / why we need it:
fix the issue that plugins in global rule may be cached to route
Pre-submission checklist: