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 v1] test: app/socket flaky fails at 1118 line
Date: Wed, 14 Aug 2019 08:27:59 +0300	[thread overview]
Message-ID: <dd0bf0616c780d100dce4601dbe22798444756ba.1565760376.git.avtikhon@tarantool.org> (raw)

Found that on hard 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]  ---

The issue was found at the fiber function:

f = fiber.create(function() s:read(12) ch:put(true) end)

that reads from socket and puts into the fiber with possible
delay which caused the issue. To aovid of it the fiber
function must be called in one shot by using the 'setopt
delimiter' functionality.

Fixes #4354
---

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

 test/app/socket.result   | 13 ++++++++++++-
 test/app/socket.test.lua |  7 ++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/test/app/socket.result b/test/app/socket.result
index 77eff7370..138946158 100644
--- a/test/app/socket.result
+++ b/test/app/socket.result
@@ -1109,9 +1109,20 @@ s = socket.tcp_connect('127.0.0.1', port)
 ch = fiber.channel()
 ---
 ...
-f = fiber.create(function() s:read(12) ch:put(true) end)
+test_run:cmd("setopt delimiter ';'")
+---
+- true
+...
+f = fiber.create(function()
+    s:read(12)
+    ch:put(true)
+end);
 ---
 ...
+test_run:cmd("setopt delimiter ''");
+---
+- true
+...
 s:close()
 ---
 - true
diff --git a/test/app/socket.test.lua b/test/app/socket.test.lua
index 7ae9a98aa..68ac4b4ac 100644
--- a/test/app/socket.test.lua
+++ b/test/app/socket.test.lua
@@ -359,7 +359,12 @@ 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)
+test_run:cmd("setopt delimiter ';'")
+f = fiber.create(function()
+    s:read(12)
+    ch:put(true)
+end);
+test_run:cmd("setopt delimiter ''");
 s:close()
 ch:get(1)
 s:error()
-- 
2.17.1

             reply	other threads:[~2019-08-14  5:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14  5:27 Alexander V. Tikhonov [this message]
2019-08-14 12:12 ` 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=dd0bf0616c780d100dce4601dbe22798444756ba.1565760376.git.avtikhon@tarantool.org \
    --to=avtikhon@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH v1] 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