Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
To: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: "Alexander V. Tikhonov" <avtikhon@tarantool.org>,
	tarantool-patches@freelists.org
Subject: [PATCH v2] test: app/socket flaky fails at 1118 line
Date: Wed, 14 Aug 2019 16:00:43 +0300	[thread overview]
Message-ID: <4ecfb707b5fd1d17c11d4bdf3825c206776ebe67.1565787619.git.avtikhon@tarantool.org> (raw)

Found that on high loaded hosts the test flaky fails at:

[004] --- app/socket.result	Mon Jul 15 07:18:57 2019
[004] +++ app/socket.reject	Tue Jul 16 16:37:35 2019
[004] @@ -1118,7 +1118,7 @@
[004]  ...
[004]  ch:get(1)
[004]  ---
[004] -- true
[004] +- null
[004]  ...
[004]  s:error()
[004]  ---

Found that the test in previous was used for testing the
the channel get() function timeout and the error occurred
on it, but later the checking error changed to:
"builtin/socket.lua: attempt to use closed socket" and the
test became not correct. Because for now it passes when the
socket read function runs before the socket closing, but in
this way read call doesn't wait. In the other way on high
loaded hosts the close call may occure before read call and
in this way read call halts and socket get call returns
'null'. As seen both ways are not correct to check the error.
Decided to remove this subtest.

Check commit ba7a4fee73 ("Add tests for socket:close closes #360")

Fixes #4354
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4354-1118-app-socket
Issue: https://github.com/tarantool/tarantool/issues/4354

 test/app/socket.result   | 58 ----------------------------------------
 test/app/socket.test.lua | 24 -----------------
 2 files changed, 82 deletions(-)

diff --git a/test/app/socket.result b/test/app/socket.result
index 77eff7370..fd299424c 100644
--- a/test/app/socket.result
+++ b/test/app/socket.result
@@ -1066,64 +1066,6 @@ tostring(s)
 s = nil
 ---
 ...
--- close
-serv = socket('AF_INET', 'SOCK_STREAM', 'tcp')
----
-...
-serv:setsockopt('SOL_SOCKET', 'SO_REUSEADDR', true)
----
-- true
-...
-serv:bind('127.0.0.1', port)
----
-- true
-...
-port = serv:name().port
----
-...
-serv:listen()
----
-- true
-...
-test_run:cmd("setopt delimiter ';'")
----
-- true
-...
-f = fiber.create(function(serv)
-    serv:readable()
-    sc = serv:accept()
-    sc:write("Tarantool test server")
-    sc:shutdown()
-    sc:close()
-    serv:close()
-end, serv);
----
-...
-test_run:cmd("setopt delimiter ''");
----
-- true
-...
-s = socket.tcp_connect('127.0.0.1', port)
----
-...
-ch = fiber.channel()
----
-...
-f = fiber.create(function() s:read(12) ch:put(true) end)
----
-...
-s:close()
----
-- true
-...
-ch:get(1)
----
-- true
-...
-s:error()
----
-- error: 'builtin/socket.lua: attempt to use closed socket'
-...
 -- random port
 master = socket('PF_INET', 'SOCK_STREAM', 'tcp')
 ---
diff --git a/test/app/socket.test.lua b/test/app/socket.test.lua
index 7ae9a98aa..c72d41763 100644
--- a/test/app/socket.test.lua
+++ b/test/app/socket.test.lua
@@ -340,30 +340,6 @@ s._gc_socket = nil
 tostring(s)
 s = nil
 
--- close
-serv = socket('AF_INET', 'SOCK_STREAM', 'tcp')
-serv:setsockopt('SOL_SOCKET', 'SO_REUSEADDR', true)
-serv:bind('127.0.0.1', port)
-port = serv:name().port
-serv:listen()
-test_run:cmd("setopt delimiter ';'")
-f = fiber.create(function(serv)
-    serv:readable()
-    sc = serv:accept()
-    sc:write("Tarantool test server")
-    sc:shutdown()
-    sc:close()
-    serv:close()
-end, serv);
-test_run:cmd("setopt delimiter ''");
-
-s = socket.tcp_connect('127.0.0.1', port)
-ch = fiber.channel()
-f = fiber.create(function() s:read(12) ch:put(true) end)
-s:close()
-ch:get(1)
-s:error()
-
 -- random port
 master = socket('PF_INET', 'SOCK_STREAM', 'tcp')
 master:setsockopt('SOL_SOCKET', 'SO_REUSEADDR', true)
-- 
2.17.1

             reply	other threads:[~2019-08-14 13:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14 13:00 Alexander V. Tikhonov [this message]
2019-08-14 13:15 ` 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=4ecfb707b5fd1d17c11d4bdf3825c206776ebe67.1565787619.git.avtikhon@tarantool.org \
    --to=avtikhon@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH v2] test: app/socket flaky fails at 1118 line' \
    /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