Skip to content
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

Merged
merged 2 commits into from
Aug 23, 2021

Conversation

nic-chen
Copy link
Member

What this PR does / why we need it:

fix the issue that plugins in global rule may be cached to route

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

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
Copy link
Member

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.

@@ -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 {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return plugins or {}
return plugins or core.tablepool.fetch("plugins", 0, 0)




=== TEST 17: delete global rules, ensure no stale data remain
Copy link
Member

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

@spacewander spacewander merged commit 1d5ecca into apache:master Aug 23, 2021
@nic-chen nic-chen deleted the fix-plugins-cache branch August 23, 2021 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants