[PATCH v1] test: app/socket flaky fails at 1951 line

Alexander V. Tikhonov avtikhon at tarantool.org
Fri Aug 16 09:15:18 MSK 2019


Found that subtest for lua socket emulation on high
loaded hosts closes the socket channel faster than
write channel on finishes:

wch:put("Fu")
c:send("354 Please type your message\n")
sc:close()

It produces the following fail:

[015] --- app/socket.result	Thu Aug 15 02:55:31 2019
[015] +++ app/socket.reject	Thu Aug 15 02:56:55 2019
[015] @@ -1951,8 +1951,7 @@
[015]  c:receive("*l", "Line: ")
[015]  ---
[015]  - null
[015] -- closed
[015] -- 'Line: Fu'
[015] +- Connection reset by peer
[015]  ...
[015]  c:receive()
[015]  ---

To fix it we need some time delay before the closing
routine call:

wch:put("Fu")
c:send("354 Please type your message\n")
fiber.sleep(.1)
sc:close()

Fixes #4426
---

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

 test/app/socket.result   | 3 +++
 test/app/socket.test.lua | 1 +
 2 files changed, 4 insertions(+)

diff --git a/test/app/socket.result b/test/app/socket.result
index fd299424c..52b1ae3cb 100644
--- a/test/app/socket.result
+++ b/test/app/socket.result
@@ -1944,6 +1944,9 @@ c:send("354 Please type your message\n")
 ---
 - 29
 ...
+fiber.sleep(.1)
+---
+...
 sc:close()
 ---
 - 1
diff --git a/test/app/socket.test.lua b/test/app/socket.test.lua
index c72d41763..785a0b757 100644
--- a/test/app/socket.test.lua
+++ b/test/app/socket.test.lua
@@ -653,6 +653,7 @@ c:receive(4)
 c:receive("*l")
 wch:put("Fu")
 c:send("354 Please type your message\n")
+fiber.sleep(.1)
 sc:close()
 c:receive("*l", "Line: ")
 c:receive()
-- 
2.17.1




More information about the Tarantool-patches mailing list