I didn't have much time to debug the plugin server code myself, but the thing is that kong.response.exit does not terminate the execution of Python code and it seems that kong.ctx.shared.set (or virtually any other PDK API call) is going to create a new event queue after it was deleted by kong.response.exit. The new queue is never deleted and it's causing the memory leak.
Hi Kong team,
We ran into another memory leak in the plugin server and were able to boil it down to the following pattern:
I didn't have much time to debug the plugin server code myself, but the thing is that
kong.response.exit
does not terminate the execution of Python code and it seems thatkong.ctx.shared.set
(or virtually any other PDK API call) is going to create a new event queue after it was deleted bykong.response.exit
. The new queue is never deleted and it's causing the memory leak.