Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH 1/1] netbox: raise an error on a closed connection async call
@ 2019-02-19 12:44 Vladislav Shpilevoy
  2019-02-21 10:31 ` Vladimir Davydov
  0 siblings, 1 reply; 2+ messages in thread
From: Vladislav Shpilevoy @ 2019-02-19 12:44 UTC (permalink / raw)
  To: tarantool-patches; +Cc: vdavydov.dev

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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] netbox: raise an error on a closed connection async call
  2019-02-19 12:44 [PATCH 1/1] netbox: raise an error on a closed connection async call Vladislav Shpilevoy
@ 2019-02-21 10:31 ` Vladimir Davydov
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Davydov @ 2019-02-21 10:31 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

Pushed to 2.1 and 1.10.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-21 10:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-19 12:44 [PATCH 1/1] netbox: raise an error on a closed connection async call Vladislav Shpilevoy
2019-02-21 10:31 ` Vladimir Davydov

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