Skip to content

Commit

Permalink
test: flaky box/net.box_wait_connected_gh-3856
Browse files Browse the repository at this point in the history
Found issue running test on FreeBSD VBox host:

 [011] --- box/net.box_wait_connected_gh-3856.result	Mon Jun 15 09:39:49 2020
 [011] +++ box/net.box_wait_connected_gh-3856.reject	Fri May  8 08:23:30 2020
 [011] @@ -12,7 +12,8 @@
 [011]  - opts:
 [011]      wait_connected: false
 [011]    host: 8.8.8.8
 [011] -  state: initial
 [011] +  state: error
 [011] +  error: Invalid argument
 [011]    port: '123456'
 [011]  ...
 [011]  c:close()

A. Turenko made deep investigation and found that the reason of the
fail was that getaddrinfo() returned EIA_SERVICE for an incorrect
TCP/IP port on FreeBSD, but crops it as modulo of 65536 on Linux/glibc.
Checked with his local script './getaddrinfo':

  (Linux/glibc) $ ./getaddrinfo 8.8.8.8 123456
  ----
  family: AF_INET
  socktype: SOCK_STREAM
  protocol: IPPROTO_TCP
  host: 8.8.8.8
  serv: 57920

  (FreeBSD) $ ./getaddrinfo 8.8.8.8 123456
  getaddrinfo: Service was not recognized for socket type

So obvious fix is to change 123456 to something less or equal to
65535. Say, 1234.

The test depended on an order in which fibers were scheduled
(net_box.connect() creates a separate fiber for connecting in background
using fiber.create(), which yields). Unlikely our fiber were not get
execution time during the connection attempt, so it was more like a
formal thing.

But we can decrease probability of this situation even more if we'll
grab all connection fields just when net_box.connect() returns, not
after yield in console (which is due to waiting a next command from
test-run).

Closes #5083

Co-authored-by: Alexander Turenko <alexander.turenko@tarantool.org>
Co-authored-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
(cherry picked from commit d51be6f)
  • Loading branch information
avtikhon authored and kyukhin committed Jun 26, 2020
1 parent 9ee9be8 commit 88f0a85
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
21 changes: 8 additions & 13 deletions test/box/net.box_wait_connected_gh-3856.result
Expand Up @@ -4,17 +4,12 @@ net = require('net.box')
--
-- gh-3856: wait_connected = false is ignored.
--
c = net.connect('8.8.8.8:123456', {wait_connected = false})
---
...
c
---
- opts:
wait_connected: false
host: 8.8.8.8
state: initial
port: '123456'
...
c:close()
---
do \
local c = net.connect('8.8.8.8:1234', {wait_connected = false}) \
local res = c.state \
c:close() \
return res \
end
---
- initial
...
9 changes: 6 additions & 3 deletions test/box/net.box_wait_connected_gh-3856.test.lua
Expand Up @@ -3,6 +3,9 @@ net = require('net.box')
--
-- gh-3856: wait_connected = false is ignored.
--
c = net.connect('8.8.8.8:123456', {wait_connected = false})
c
c:close()
do \
local c = net.connect('8.8.8.8:1234', {wait_connected = false}) \
local res = c.state \
c:close() \
return res \
end

0 comments on commit 88f0a85

Please sign in to comment.