Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: avtikhon@tarantool.org, v.shpilevoy@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH] feedback_daemon: fix indexing a nil value issue
Date: Mon, 19 Apr 2021 20:53:57 +0300	[thread overview]
Message-ID: <20210419175357.13479-1-sergepetrenko@tarantool.org> (raw)

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)


             reply	other threads:[~2021-04-19 17:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 17:53 Serge Petrenko via Tarantool-patches [this message]
2021-04-19 22:39 ` Vladislav Shpilevoy via Tarantool-patches
2021-04-20  9:28   ` Serge Petrenko via Tarantool-patches
2021-04-20 19:42     ` Vladislav Shpilevoy via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210419175357.13479-1-sergepetrenko@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=avtikhon@tarantool.org \
    --cc=sergepetrenko@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] feedback_daemon: fix indexing a nil value issue' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox