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 1D734230F8 for ; Mon, 15 Jul 2019 06:20:43 -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 TJO72Yi_tZ2J for ; Mon, 15 Jul 2019 06:20:43 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 72B0320647 for ; Mon, 15 Jul 2019 06:20:42 -0400 (EDT) From: imeevma@tarantool.org Subject: [tarantool-patches] [PATCH v1 1/1] box: increase connection timeout in "net.box.test.lua" Date: Mon, 15 Jul 2019 13:20:38 +0300 Message-Id: <667a69a7b37236d443212da8289c34d2bc56c722.1563185673.git.imeevma@gmail.com> 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: v.shpilevoy@tarantool.org Cc: avtikhon@tarantool.org, tarantool-patches@freelists.org 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, { -- 2.7.4