From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id D7F492040F for ; Mon, 15 Jul 2019 18:11:46 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IQ48zVLrvv5T for ; Mon, 15 Jul 2019 18:11:46 -0400 (EDT) Received: from smtp60.i.mail.ru (smtp60.i.mail.ru [217.69.128.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 2BA67203B5 for ; Mon, 15 Jul 2019 18:11:45 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v1 1/1] box: increase connection timeout in "net.box.test.lua" References: <667a69a7b37236d443212da8289c34d2bc56c722.1563185673.git.imeevma@gmail.com> From: Vladislav Shpilevoy Message-ID: Date: Tue, 16 Jul 2019 00:13:17 +0200 MIME-Version: 1.0 In-Reply-To: <667a69a7b37236d443212da8289c34d2bc56c722.1563185673.git.imeevma@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: imeevma@tarantool.org Cc: avtikhon@tarantool.org, tarantool-patches@freelists.org LGTM. On 15/07/2019 12:20, imeevma@tarantool.org wrote: > The "box/net.box.test.lua" test contains a check that the error > received contains a 'timed out'. But in cases when testing was > conducted on a slow computer or in the case of a very large load, > it is possible that the connection time-out will be reached > earlier than the mentioned error. In this case, the error "Invalid > argument" will be returned. To prevent this from happening, > this patch will increase the connection timeout. > > Closes #4341 > --- > The patch was tested by @avtikhon. The specified error no longer > occurs. > > https://github.com/tarantool/tarantool/issues/4341 > https://github.com/tarantool/tarantool/tree/imeevma/gh-4341-increase-connection-timeout > > test/box/net.box.result | 10 ++++++++-- > test/box/net.box.test.lua | 8 ++++++-- > 2 files changed, 14 insertions(+), 4 deletions(-) > > diff --git a/test/box/net.box.result b/test/box/net.box.result > index 6467629..0803956 100644 > --- a/test/box/net.box.result > +++ b/test/box/net.box.result > @@ -2109,6 +2109,9 @@ test_run:cmd("setopt delimiter ';'"); > --- > - true > ... > +need_stop = false; > +--- > +... > greeting = > "Tarantool 1.7.3 (Lua console)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" .. > "type 'help' for interactive help~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; > @@ -2120,7 +2123,9 @@ socket = require('socket'); > srv = socket.tcp_server('localhost', 0, { > handler = function(fd) > local fiber = require('fiber') > - fiber.sleep(0.1) > + while not need_stop do > + fiber.sleep(0.01) > + end > fd:write(greeting) > end > }); > @@ -2130,7 +2135,7 @@ srv = socket.tcp_server('localhost', 0, { > port = srv:name().port > nb = net.new('localhost:' .. port, { > wait_connected = true, console = true, > - connect_timeout = 0.01 > + connect_timeout = 0.1 > }); > --- > ... > @@ -2138,6 +2143,7 @@ nb.error:find('timed out') ~= nil; > --- > - true > ... > +need_stop = true > nb:close(); > --- > ... > diff --git a/test/box/net.box.test.lua b/test/box/net.box.test.lua > index a84f6db..3677b30 100644 > --- a/test/box/net.box.test.lua > +++ b/test/box/net.box.test.lua > @@ -837,6 +837,7 @@ c:close() > > -- Test for connect_timeout > 0 in netbox connect > test_run:cmd("setopt delimiter ';'"); > +need_stop = false; > greeting = > "Tarantool 1.7.3 (Lua console)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" .. > "type 'help' for interactive help~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; > @@ -844,7 +845,9 @@ socket = require('socket'); > srv = socket.tcp_server('localhost', 0, { > handler = function(fd) > local fiber = require('fiber') > - fiber.sleep(0.1) > + while not need_stop do > + fiber.sleep(0.01) > + end > fd:write(greeting) > end > }); > @@ -852,9 +855,10 @@ port = srv:name().port > -- we must get timeout > nb = net.new('localhost:' .. port, { > wait_connected = true, console = true, > - connect_timeout = 0.01 > + connect_timeout = 0.1 > }); > nb.error:find('timed out') ~= nil; > +need_stop = true > nb:close(); > -- we must get peer closed > nb = net.new('localhost:' .. port, { >