[Tarantool-patches] [PATCH] feedback_daemon: fix indexing a nil value issue
Serge Petrenko
sergepetrenko at tarantool.org
Mon Apr 19 20:53:57 MSK 2021
When running tarantool with disabled feedback daemon the following error
appeared on each space/index create/drop:
builtin/box/feedback_daemon.lua:380: attempt to index field 'cached_events'
(a nil value)
This happened because 'cached_events' table is initialized only on
feedback daemon start.
Fix the issue by checking for type of `cached_events` and only indexing
it when it's a table.
Follow-up #5750
---
branch: https://github.com/tarantool/tarantool/tree/sp/feedback-daemon-fix
src/box/lua/feedback_daemon.lua | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/box/lua/feedback_daemon.lua b/src/box/lua/feedback_daemon.lua
index 7a6b0c94c..ee0315c2d 100644
--- a/src/box/lua/feedback_daemon.lua
+++ b/src/box/lua/feedback_daemon.lua
@@ -377,6 +377,10 @@ local function save_event(self, event)
if type(event) ~= 'string' then
error("Usage: box.internal.feedback_daemon.save_event(string)")
end
+ if type(self.cached_events) ~= 'table' then
+ return
+ end
+
self.cached_events[event] = (self.cached_events[event] or 0) + 1
if self.cached_events[event] == 1 then
-- The first occurred event of this type triggers report dispatch
--
2.24.3 (Apple Git-128)
More information about the Tarantool-patches
mailing list