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(pluginservers): restart all instances of a plugin #11306

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@
- Make `kong vault get` CLI command work in dbless mode by injecting the necessary directives into the kong cli nginx.conf.
[#11127](https://github.com/Kong/kong/pull/11127)
[#11291](https://github.com/Kong/kong/pull/11291)
- Fix an issue where a crashing Go plugin server process would cause subsequent
requests proxied through Kong to execute Go plugins with inconsistent configurations.
The issue only affects scenarios where the same Go plugin is applied to different Route
or Service entities.
[#11306](https://github.com/Kong/kong/pull/11306)

#### Admin API

Expand Down
15 changes: 14 additions & 1 deletion kong/runloop/plugin_servers/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,20 @@ end
--- reset_instance: removes an instance from the table.
function reset_instance(plugin_name, conf)
local key = type(conf) == "table" and kong.plugin.get_id() or plugin_name
running_instances[key] = nil
local current_instance = running_instances[key]

--
-- the same plugin (which acts as a plugin server) is shared among
-- instances of the plugin; for example, the same plugin can be applied
-- to many routes
-- `reset_instance` is called when (but not only) the plugin server died;
-- in such case, all associated instances must be removed, not only the current
--
for k, instance in pairs(running_instances) do
if instance.rpc == current_instance.rpc then
running_instances[k] = nil
flrgh marked this conversation as resolved.
Show resolved Hide resolved
end
end
end


Expand Down