From 59bdf755205e3f0e25e4727f567d0556952b21a7 Mon Sep 17 00:00:00 2001 From: xumin Date: Wed, 15 Nov 2023 15:27:37 +0800 Subject: [PATCH] fix(plugin server): an instance for every request As the __key__ changes its definition (cache key) it can never match a plugin's uuid. change to use __plugin_id. Fix KAG-2969 --- changelog/unreleased/kong/plugin-server-instance-leak.yml | 3 +++ kong/runloop/plugin_servers/init.lua | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/kong/plugin-server-instance-leak.yml diff --git a/changelog/unreleased/kong/plugin-server-instance-leak.yml b/changelog/unreleased/kong/plugin-server-instance-leak.yml new file mode 100644 index 00000000000..c00cbfc69e6 --- /dev/null +++ b/changelog/unreleased/kong/plugin-server-instance-leak.yml @@ -0,0 +1,3 @@ +message: "**Plugin Server**: fix an issue where every request causes a new plugin instance to be created" +type: bugfix +scope: PDK diff --git a/kong/runloop/plugin_servers/init.lua b/kong/runloop/plugin_servers/init.lua index c78913f4cf8..6c3937efc8e 100644 --- a/kong/runloop/plugin_servers/init.lua +++ b/kong/runloop/plugin_servers/init.lua @@ -213,7 +213,7 @@ function get_instance_id(plugin_name, conf) if instance_info and instance_info.id - and instance_info.conf and instance_info.conf.__key__ == key + and instance_info.conf and instance_info.conf.__plugin_id == key then -- exact match, return it return instance_info.id