From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: vdavydov.dev@gmail.com
Subject: [PATCH 1/1] netbox: raise an error on a closed connection async call
Date: Tue, 19 Feb 2019 15:44:53 +0300 [thread overview]
Message-ID: <f1f7c3204b891288ad04e55850d803c6ab1feac7.1550580239.git.v.shpilevoy@tarantool.org> (raw)
When a connection is closed, it should not allow any
requests - async and not. But before this patch this error
from netbox.perform_async_request was ignored.
---
Branch: https://github.com/tarantool/tarantool/tree/gerold103/fix-netbox-async-call
src/box/lua/net_box.lua | 9 +++++++--
test/box/net.box.result | 7 +++++++
test/box/net.box.test.lua | 5 +++++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
index 2bf772aa8..b3139a3f5 100644
--- a/src/box/lua/net_box.lua
+++ b/src/box/lua/net_box.lua
@@ -1056,8 +1056,13 @@ function remote_methods:_request(method, opts, ...)
if opts.on_push or opts.on_push_ctx then
error('To handle pushes in an async request use future:pairs()')
end
- return transport.perform_async_request(buffer, method, table.insert,
- {}, ...)
+ local res, err =
+ transport.perform_async_request(buffer, method, table.insert,
+ {}, ...)
+ if err then
+ box.error(err)
+ end
+ return res
end
if opts.timeout then
-- conn.space:request(, { timeout = timeout })
diff --git a/test/box/net.box.result b/test/box/net.box.result
index 2b5a84646..6351898b3 100644
--- a/test/box/net.box.result
+++ b/test/box/net.box.result
@@ -2836,6 +2836,13 @@ future:wait_result(100)
c:close()
---
...
+--
+-- Check that is_async does not work on a closed connection.
+--
+c:call('any_func', {}, {is_async = true})
+---
+- error: Connection closed
+...
box.schema.user.revoke('guest', 'execute', 'universe')
---
...
diff --git a/test/box/net.box.test.lua b/test/box/net.box.test.lua
index 96d822820..6c527f506 100644
--- a/test/box/net.box.test.lua
+++ b/test/box/net.box.test.lua
@@ -1161,6 +1161,11 @@ finalize_long()
future:wait_result(100)
c:close()
+--
+-- Check that is_async does not work on a closed connection.
+--
+c:call('any_func', {}, {is_async = true})
+
box.schema.user.revoke('guest', 'execute', 'universe')
c = net:connect(box.cfg.listen)
--
2.17.2 (Apple Git-113)
next reply other threads:[~2019-02-19 12:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-19 12:44 Vladislav Shpilevoy [this message]
2019-02-21 10:31 ` Vladimir Davydov
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=f1f7c3204b891288ad04e55850d803c6ab1feac7.1550580239.git.v.shpilevoy@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=vdavydov.dev@gmail.com \
--subject='Re: [PATCH 1/1] netbox: raise an error on a closed connection async call' \
/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