From: Olga Arkhangelskaia <arkholga@tarantool.org> To: tarantool-patches@dev.tarantool.org Cc: v.shpilevoy@tarantool.org, alexander.turenko@tarantool.org Subject: [Tarantool-patches] [PATCH] netbox: fix empty error message Date: Mon, 22 Jun 2020 21:34:33 +0300 [thread overview] Message-ID: <20200622183433.64739-1-arkholga@tarantool.org> (raw) When the connection was not established yet netbox reported empty error while executing a remote request. Closes #4787 --- Branch OKriw/gh-4787-netbox-reports-empty-error src/box/lua/net_box.lua | 6 ++-- test/app/gh-4787-netbox-empty-errmsg.result | 34 +++++++++++++++++++ test/app/gh-4787-netbox-empty-errmsg.test.lua | 15 ++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 test/app/gh-4787-netbox-empty-errmsg.result create mode 100755 test/app/gh-4787-netbox-empty-errmsg.test.lua diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua index 9560bfdd4..6774729b4 100644 --- a/src/box/lua/net_box.lua +++ b/src/box/lua/net_box.lua @@ -541,8 +541,10 @@ local function create_transport(host, port, user, password, callback, local function perform_async_request(buffer, skip_header, method, on_push, on_push_ctx, request_ctx, ...) if state ~= 'active' and state ~= 'fetch_schema' then - return nil, box.error.new({code = last_errno or E_NO_CONNECTION, - reason = last_error}) + return nil, box.error.new({code = last_error or E_NO_CONNECTION, + reason = last_error or + string.format("connection is not eshatblished, state: %s", + state)}) end -- alert worker to notify it of the queued outgoing data; -- if the buffer wasn't empty, assume the worker was already alerted diff --git a/test/app/gh-4787-netbox-empty-errmsg.result b/test/app/gh-4787-netbox-empty-errmsg.result new file mode 100644 index 000000000..9e14cfb19 --- /dev/null +++ b/test/app/gh-4787-netbox-empty-errmsg.result @@ -0,0 +1,34 @@ +-- test-run result file version 2 +netbox = require('net.box') + | --- + | ... +-- +--gh-4787:netbox reported empty error message while executing remote call +-- +box.schema.user.grant('guest', 'execute', 'universe') + | --- + | ... +ok, err = nil + | --- + | ... +-- Due to race when wait_connected = false, run whole block to get an error +do \ + c = netbox.connect(box.cfg.listen, {wait_connected = false}) \ + ok, err = pcall(c.call, c, 'any', {}, {is_async = true}) \ +end + | --- + | ... +err ~= nil + | --- + | - true + | ... +err:unpack().message ~= nil + | --- + | - true + | ... +c:close() + | --- + | ... +box.schema.user.revoke('guest', 'read,write,execute,create', 'universe') + | --- + | ... diff --git a/test/app/gh-4787-netbox-empty-errmsg.test.lua b/test/app/gh-4787-netbox-empty-errmsg.test.lua new file mode 100755 index 000000000..2949f16ea --- /dev/null +++ b/test/app/gh-4787-netbox-empty-errmsg.test.lua @@ -0,0 +1,15 @@ +netbox = require('net.box') +-- +--gh-4787:netbox reported empty error message while executing remote call +-- +box.schema.user.grant('guest', 'execute', 'universe') +ok, err = nil +-- Due to race when wait_connected = false, run whole block to get an error +do \ + c = netbox.connect(box.cfg.listen, {wait_connected = false}) \ + ok, err = pcall(c.call, c, 'any', {}, {is_async = true}) \ +end +err ~= nil +err:unpack().message ~= nil +c:close() +box.schema.user.revoke('guest', 'read,write,execute,create', 'universe') -- 2.20.1 (Apple Git-117)
next reply other threads:[~2020-06-22 18:34 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-22 18:34 Olga Arkhangelskaia [this message] 2020-06-22 21:23 ` Vladislav Shpilevoy 2020-06-23 11:24 ` Olga Arkhangelskaia 2020-06-23 21:18 ` Vladislav Shpilevoy 2020-07-08 21:10 ` Alexander Turenko 2020-10-29 19:12 ` Alexander Turenko
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=20200622183433.64739-1-arkholga@tarantool.org \ --to=arkholga@tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH] netbox: fix empty error message' \ /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