Skip to content

test: box-tap/cfg test flaky fails at high loaded host on OSX14 #10

Open
@avtikhon

Description

@avtikhon

Tarantool version:
master

OS version:
OSX 14

Bug description:

[038] box-tap/cfg.test.lua                                            
[038] not ok 101 - remote syslog log configuration #  
[038] Expected: 0
[038] Got:      256
[038] Traceback:
[038] [main] at </Users/tarantool/tarantool/test/box-tap/cfg.test.lua:0>
[038] 

Steps to reproduce:

l=0 ; while ./test-run.py -j40 `for r in {1..1500} ; do echo box-tap/cfg.test.lua ; done` 2>/dev/null ; do l=$(($l+1)) ; echo ======== $l ============= ; done

Reproducer:

#!/usr/bin/env tarantool

local tap = require('tap')
local test = tap.test('cfg')
local socket = require('socket')
local fio = require('fio')
local uuid = require('uuid')
local msgpack = require('msgpack')
test:plan(1)

local box = require('box')
os.execute("rm -rf vinyl")
box.cfg{
    log="tarantool.log",
    log_nonblock=false,
    memtx_memory=104857600,
    wal_mode = "", -- "" means default value
}

--------------------------------------------------------------------------------
-- Dynamic configuration
--------------------------------------------------------------------------------

local tarantool_bin = arg[-1]
local PANIC = 256
function run_script(code)
    local dir = fio.tempdir()
    local script_path = fio.pathjoin(dir, 'script.lua')
    local script = fio.open(script_path, {'O_CREAT', 'O_WRONLY', 'O_APPEND'},
        tonumber('0777', 8))
    script:write(code)
    script:write("\nos.exit(0)")
    script:close()
    local cmd = [[/bin/sh -c 'cd "%s" && "%s" ./script.lua 2> /dev/null']]
    local res = os.execute(string.format(cmd, dir, tarantool_bin))
    fio.rmtree(dir)
    return res
end

--
-- Check syslog remote configuration
--
code = [[
local socket = require('socket')
local log = require('log')

addr = '127.0.0.1'
port = 1000 + math.random(32768)

sc = socket('AF_INET', 'SOCK_DGRAM', 'udp')
local attempt = 0
while attempt < 10 do
    if not sc:bind (addr, port) then
        port = 1000 + math.random(32768)
        attempt = attempt + 1
    else
        break
    end
end
sc:bind(addr, port)

local opt = string.format("syslog:server=%s:%u,identity=tarantool", addr, port)
local res = 1
local buf = 'Started\n'
box.cfg{log = opt}

-- make sure that socket would not block
while sc:readable(0.001) do
    buf = buf .. sc:recv(1000)
end
log.info('Test syslog destination')
while sc:readable(0.001) do
    buf = buf .. sc:recv(1000)
    if buf:match('Test syslog destination') then res = 0 end
end

sc:close()
os.exit(res)
]]
test:is(run_script(code), 0, "remote syslog log configuration")

test:check()
os.exit(0)

Optional (but very desirable):

  • coredump
  • backtrace
  • netstat

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions