Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin <imun@tarantool.org>
To: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org,
	Alexander Turenko <alexander.turenko@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v1] test: fix flaky box/on_shutdown.test.lua on asan
Date: Wed, 9 Sep 2020 15:04:07 +0300	[thread overview]
Message-ID: <20200909120407.GH18920@tarantool.org> (raw)
In-Reply-To: <f599e2dbba1ad2e7d4bbc6915ad2f467a30eb303.1598861611.git.avtikhon@tarantool.org>

Sasha,

Thanks for the patch! I just dump my thoughts regarding the issue, as
you asked in offline.

I'm totally not a test-run expert, so I can only say something from
Tarantool Lua sockets and Lua GC side.

<socket> connection releases the descriptor in a two ways:
* via explicit <socket_close>[1] call
* implicitly using <gc_socket_t> __gc metamethod[2]

I see no explicit close for socket created within <test_run.cmd> function
so I guess you faced the latter approach.

I guess your solution fixes the issue, since GC machinery *might* call
the corresponding __gc metamethod after <fiber.sleep> returns. However,
with <collectrgarbage> call the GC engine makes a full collection cycle
and "dead" sock object is released (strictly saying at least its __gc
metamethod is called).

I have several questions to you:
* How does test-run handle these commands and connections?
* Why do other start/stop actions in this test chunk stay unaffected?

I believe you need to go deeper a bit to find the exact root cause. As a
result you can describe the issue in a more precise way. Feel free to
ask me about Lua behaviour that you find strange/mystifying.

On 31.08.20, Alexander V. Tikhonov wrote:
> Found that box/on_shutdown.test.lua test fails on asan build with:
> 
>   2020-08-26 09:04:06.750 [42629] main/102/on_shutdown [string "_ = box.ctl.on_shutdown(function() log.warn("..."]:1 W> on_shutdown 5
>   Starting instance proxy...
>   Run console at unix/:/tnt/test/var/001_box/proxy.control
>   Start failed: builtin/box/console.lua:865: failed to create server unix/:/tnt/test/var/001_box/proxy.control: Address already in use
> 
> It happened on ASAN build, because server stop routine
> 
>   test-run/lib/preprocessor.py:TestState.server_stop() ->
>     test-run/lib/tarantool_server.py:TarantoolServer.stop()
> 
> needs to free the proxy.control socket created by
> 
>   test-run/lib/preprocessor.py:TestState.server_start() ->
>     tarantoolctl:process_local()
> 
> On some builds like ASAN server stop routine needs more time to free
> the 'proxy.control' socket. So instead of time delay before server
> restart need to use garbage collector to be sure that it will be freed.
> 
> Closes #5260
> Part of #4360
> ---
> 
> Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-5260-on-shutdown-test
> Issue: https://github.com/tarantool/tarantool/issues/5260
> Issue: https://github.com/tarantool/tarantool/issues/4360
> 

<snipped>

> 

[1]: https://github.com/tarantool/tarantool/blob/master/src/lua/socket.lua#L108L119
[2]: https://github.com/tarantool/tarantool/blob/master/src/lua/socket.lua#L64L72

-- 
Best regards,
IM

  reply	other threads:[~2020-09-09 12:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31  8:15 Alexander V. Tikhonov
2020-09-09 12:04 ` Igor Munkin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-08-26 14:24 Alexander V. Tikhonov

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=20200909120407.GH18920@tarantool.org \
    --to=imun@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=avtikhon@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1] test: fix flaky box/on_shutdown.test.lua on asan' \
    /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