From 816683f0b6707771c24f0fe73cc33f481b97dfc9 Mon Sep 17 00:00:00 2001 From: wiaamm Date: Sat, 6 Dec 2025 16:31:15 +0200 Subject: [PATCH] remove GC --- .../open-appsec-waf-kong-plugin/handler.lua | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/attachments/kong/plugins/open-appsec-waf-kong-plugin/handler.lua b/attachments/kong/plugins/open-appsec-waf-kong-plugin/handler.lua index 60e7735..133672b 100755 --- a/attachments/kong/plugins/open-appsec-waf-kong-plugin/handler.lua +++ b/attachments/kong/plugins/open-appsec-waf-kong-plugin/handler.lua @@ -40,7 +40,8 @@ function NanoHandler.access(conf) kong.log.err("Failed to handle start transaction - failing open") nano.fini_session(session_data) nano.cleanup_all() - collectgarbage("restart") + --collectgarbage("restart") + --collectgarbage("collect") kong.ctx.plugin.session_data = nil kong.ctx.plugin.session_id = nil return @@ -51,7 +52,8 @@ function NanoHandler.access(conf) kong.log.err("Failed to handle request headers - failing open") nano.fini_session(session_data) nano.cleanup_all() - collectgarbage("restart") + --collectgarbage("restart") + --collectgarbage("collect") kong.ctx.plugin.session_data = nil kong.ctx.plugin.session_id = nil return @@ -66,7 +68,7 @@ function NanoHandler.access(conf) local result = nano.handle_custom_response(session_data, response) nano.fini_session(session_data) nano.cleanup_all() - collectgarbage("restart") + --collectgarbage("restart") kong.ctx.plugin.session_data = nil kong.ctx.plugin.session_id = nil return result @@ -81,7 +83,7 @@ function NanoHandler.access(conf) local result = nano.handle_custom_response(session_data, response) nano.fini_session(session_data) nano.cleanup_all() - collectgarbage("restart") + --collectgarbage("restart") kong.ctx.plugin.session_data = nil kong.ctx.plugin.session_id = nil return result @@ -98,7 +100,7 @@ function NanoHandler.access(conf) local result = nano.handle_custom_response(session_data, response) nano.fini_session(session_data) nano.cleanup_all() - collectgarbage("restart") + --collectgarbage("restart") kong.ctx.plugin.session_data = nil kong.ctx.plugin.session_id = nil return result @@ -146,7 +148,7 @@ function NanoHandler.access(conf) kong.log.err("Error ending request inspection: ", pcall_verdict, " - failing open") nano.fini_session(session_data) nano.cleanup_all() - collectgarbage("restart") + --collectgarbage("restart") kong.ctx.plugin.session_data = nil kong.ctx.plugin.session_id = nil return @@ -159,7 +161,7 @@ function NanoHandler.access(conf) local result = nano.handle_custom_response(session_data, response) nano.fini_session(session_data) nano.cleanup_all() - collectgarbage("restart") + --collectgarbage("restart") kong.ctx.plugin.session_data = nil kong.ctx.plugin.session_id = nil return result @@ -171,7 +173,7 @@ function NanoHandler.access(conf) local result = nano.handle_custom_response(session_data, response) nano.fini_session(session_data) nano.cleanup_all() - collectgarbage("restart") + --collectgarbage("restart") kong.ctx.plugin.session_data = nil kong.ctx.plugin.session_id = nil return result @@ -246,7 +248,8 @@ function NanoHandler.body_filter(conf) kong.log.err("Body filter timeout after ", elapsed_time, " seconds - failing open") nano.fini_session(session_data) nano.cleanup_all() - collectgarbage("restart") + -- collectgarbage("restart") + -- collectgarbage("collect") -- Force immediate collection ctx.session_finalized = true ctx.session_data = nil ctx.session_id = nil @@ -282,7 +285,8 @@ function NanoHandler.body_filter(conf) nano.fini_session(session_data) -- Clean up allocated memory nano.cleanup_all() - collectgarbage("restart") + --collectgarbage("restart") + --collectgarbage("collect") -- Force immediate collection ctx.session_data = nil ctx.session_id = nil ngx.arg[1] = "" @@ -309,7 +313,8 @@ function NanoHandler.body_filter(conf) nano.fini_session(session_data) -- Clean up allocated memory nano.cleanup_all() - collectgarbage("restart") + -- collectgarbage("restart") + --collectgarbage("collect") -- Force immediate collection ctx.session_data = nil ctx.session_id = nil ngx.arg[1] = "" @@ -320,7 +325,8 @@ function NanoHandler.body_filter(conf) nano.fini_session(session_data) -- Clean up allocated memory nano.cleanup_all() - collectgarbage("restart") + --collectgarbage("restart") + --collectgarbage("collect") -- Force immediate collection ctx.session_finalized = true ctx.session_data = nil ctx.session_id = nil