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(batch-processor): we didn't free stale object actually #5700

Merged
merged 1 commit into from
Dec 6, 2021
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
3 changes: 2 additions & 1 deletion apisix/plugins/datadog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ local format = string.format
local concat = table.concat
local buffers = {}
local ipairs = ipairs
local pairs = pairs
local tostring = tostring
local stale_timer_running = false
local timer_at = ngx.timer.at
Expand Down Expand Up @@ -120,7 +121,7 @@ local function remove_stale_objects(premature)
return
end

for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))
Expand Down
4 changes: 2 additions & 2 deletions apisix/plugins/google-cloud-logging.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
local core = require("apisix.core")
local ngx = ngx
local tostring = tostring
local ipairs = ipairs
local pairs = pairs
local ngx_timer_at = ngx.timer.at
local http = require("resty.http")
local log_util = require("apisix.utils.log-util")
Expand Down Expand Up @@ -128,7 +128,7 @@ local function remove_stale_objects(premature)
return
end

for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, route id:", tostring(key))
buffers[key] = nil
Expand Down
3 changes: 2 additions & 1 deletion apisix/plugins/http-logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ local plugin = require("apisix.plugin")
local ngx = ngx
local tostring = tostring
local ipairs = ipairs
local pairs = pairs
local timer_at = ngx.timer.at

local plugin_name = "http-logger"
Expand Down Expand Up @@ -166,7 +167,7 @@ local function remove_stale_objects(premature)
return
end

for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))
Expand Down
3 changes: 1 addition & 2 deletions apisix/plugins/kafka-logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ local plugin = require("apisix.plugin")
local math = math
local pairs = pairs
local type = type
local ipairs = ipairs
local plugin_name = "kafka-logger"
local stale_timer_running = false
local timer_at = ngx.timer.at
Expand Down Expand Up @@ -164,7 +163,7 @@ local function remove_stale_objects(premature)
return
end

for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))
Expand Down
4 changes: 2 additions & 2 deletions apisix/plugins/skywalking-logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ local ngx_re = require("ngx.re")
local ngx = ngx
local tostring = tostring
local tonumber = tonumber
local ipairs = ipairs
local pairs = pairs
local timer_at = ngx.timer.at

local plugin_name = "skywalking-logger"
Expand Down Expand Up @@ -130,7 +130,7 @@ local function remove_stale_objects(premature)
return
end

for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))
Expand Down
3 changes: 2 additions & 1 deletion apisix/plugins/sls-logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ local tcp = ngx.socket.tcp
local buffers = {}
local tostring = tostring
local ipairs = ipairs
local pairs = pairs
local table = table
local schema = {
type = "object",
Expand Down Expand Up @@ -116,7 +117,7 @@ local function remove_stale_objects(premature)
return
end

for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, route id:", tostring(key))
buffers[key] = nil
Expand Down
4 changes: 2 additions & 2 deletions apisix/plugins/syslog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local logger_socket = require("resty.logger.socket")
local plugin_name = "syslog"
local ngx = ngx
local buffers = {}
local ipairs = ipairs
local pairs = pairs
local stale_timer_running = false;
local timer_at = ngx.timer.at

Expand Down Expand Up @@ -121,7 +121,7 @@ local function remove_stale_objects(premature)
return
end

for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))
Expand Down
4 changes: 2 additions & 2 deletions apisix/plugins/tcp-logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local tostring = tostring
local buffers = {}
local ngx = ngx
local tcp = ngx.socket.tcp
local ipairs = ipairs
local pairs = pairs
local stale_timer_running = false
local timer_at = ngx.timer.at

Expand Down Expand Up @@ -106,7 +106,7 @@ local function remove_stale_objects(premature)
return
end

for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))
Expand Down
4 changes: 2 additions & 2 deletions apisix/plugins/udp-logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local tostring = tostring
local buffers = {}
local ngx = ngx
local udp = ngx.socket.udp
local ipairs = ipairs
local pairs = pairs
local stale_timer_running = false;
local timer_at = ngx.timer.at

Expand Down Expand Up @@ -90,7 +90,7 @@ local function remove_stale_objects(premature)
return
end

for key, batch in ipairs(buffers) do
for key, batch in pairs(buffers) do
if #batch.entry_buffer.entries == 0 and #batch.batch_to_process == 0 then
core.log.warn("removing batch processor stale object, conf: ",
core.json.delay_encode(key))
Expand Down