From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Serge Petrenko Subject: [PATCH] test: fix net.box occasional failure. Again Date: Tue, 9 Jul 2019 12:31:11 +0300 Message-Id: <20190709093111.21718-1-sergepetrenko@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: vdavydov.dev@gmail.com Cc: tarantool-patches@freelists.org, Serge Petrenko List-ID: The test regarding logging corrupted rows failed occasionally with ``` [016] test_run:grep_log('default', 'Got a corrupted row.*') [016] --- [016] -- 'Got a corrupted row:' [016] +- null [016] ... ``` The logs then had ``` [010] 2019-07-06 19:36:16.857 [13046] iproto sio.c:261 !> SystemError writev(1), called on fd 23, aka unix/:(socket), peer of unix/:(socket): Broken pipe ``` instead of the expected message. This happened, because we closed a socket before tarantool could write a greeting to the client, the connection was then closed, and execution never got to processing the malformed request and thus printing the desired message to the log. To fix this, actually read the greeting prior to writing new data and closing the socket. Follow-up #4273 --- https://github.com/tarantool/tarantool/issues/4273 https://github.com/tarantool/tarantool/tree/sp/gh-4273-netbox-flaky The patch should also appear in 1.10 and 2.1. It is also worth cherry-picking commit 07a84a97d8fafc9d32019578757244f96f26aa05 (test: fix net.box occasional failure.) to 1.10 and 2.1. We didn't do it initially. test/box/net.box.result | 4 ++++ test/box/net.box.test.lua | 1 + 2 files changed, 5 insertions(+) diff --git a/test/box/net.box.result b/test/box/net.box.result index ca976ab21..a18546d12 100644 --- a/test/box/net.box.result +++ b/test/box/net.box.result @@ -3855,6 +3855,10 @@ box.cfg{log_level=6} sock = socket.tcp_connect(LISTEN.host, LISTEN.service) --- ... +sock:read(9) +--- +- Tarantool +... -- we need to have a packet with correctly encoded length, -- so that it bypasses iproto length check, but cannot be -- decoded in xrow_header_decode diff --git a/test/box/net.box.test.lua b/test/box/net.box.test.lua index fde496283..07558a0dc 100644 --- a/test/box/net.box.test.lua +++ b/test/box/net.box.test.lua @@ -1551,6 +1551,7 @@ box.cfg{readahead = readahead} log_level = box.cfg.log_level box.cfg{log_level=6} sock = socket.tcp_connect(LISTEN.host, LISTEN.service) +sock:read(9) -- we need to have a packet with correctly encoded length, -- so that it bypasses iproto length check, but cannot be -- decoded in xrow_header_decode -- 2.20.1 (Apple Git-117)