From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/1] test: fix flaky box/gh-4627-session-use-after-free
Date: Wed, 4 Dec 2019 14:35:37 +0300 [thread overview]
Message-ID: <20191204113537.dqofwyaojalu5jun@tkn_work_nb> (raw)
In-Reply-To: <f577002be9c5dc04530e7d947413ebd930bc2227.1575331483.git.v.shpilevoy@tarantool.org>
This fix itself is okay for me, but, please, look at a few minor
comments below.
WBR, Alexander Turenko.
On Tue, Dec 03, 2019 at 01:05:30AM +0100, Vladislav Shpilevoy wrote:
> The problem was in that the test uses the global trigger
> box.session.on_disconnect() to set a global variable by one
> connection. But test-run can do multiple connects/reconnects to
> the same instance. That led to multiple invocations of
> box.session.on_disconnect(), which could override the global
> variable in unexpected ways and moments.
>
> The patch makes only one session execute that trigger.
>
> Probably related to https://github.com/tarantool/test-run/issues/46
> Follow up #4627
> ---
> Branch: https://github.com/tarantool/tarantool/tree/gerold103/session-flaky-test
>
> .../box/gh-4627-session-use-after-free.result | 28 +++++++++++++++++++
> .../gh-4627-session-use-after-free.test.lua | 20 +++++++++++++
> 2 files changed, 48 insertions(+)
> diff --git a/test/box/gh-4627-session-use-after-free.test.lua b/test/box/gh-4627-session-use-after-free.test.lua
> index 70624a96a..1b2ebfdc4 100644
> --- a/test/box/gh-4627-session-use-after-free.test.lua
> +++ b/test/box/gh-4627-session-use-after-free.test.lua
> @@ -15,15 +15,33 @@
> net_box = require('net.box')
> fiber = require('fiber')
>
> +box.schema.user.grant('guest', 'execute', 'universe')
> +
> +-- This is a workaround for flakiness of the test
> +-- appearing when another test tries to connect to
I tentative that another test may access to a unix socket (tarantool's
binary port) that run on another worker: all those sockets are placed in
worker's directory. It seems that test-run itself doing some reconnects.
> +-- this one. By setting a flag for only one
> +-- session, others won't interfere in
> +-- session.on_disconnect().
> +function enable_on_disconnect() \
> + box.session.storage.is_enabled = true \
> +end
> +
> sid_before_yield = nil
> sid_after_yield = nil
> func = box.session.on_disconnect(function() \
> + if not box.session.storage.is_enabled then \
> + return \
> + end \
> sid_before_yield = box.session.id() \
> fiber.yield() \
> sid_after_yield = box.session.id() \
> end)
>
> connection = net_box.connect(box.cfg.listen)
> +-- Connections, not related to this one, won't
> +-- call this function, and therefore won't do
> +-- anything in session.on_disconnect() trigger.
> +connection:call('enable_on_disconnect')
> connection:ping()
It seems that :ping() is not needed anymore.
> connection:close()
>
> @@ -33,3 +51,5 @@ sid_after_yield == sid_before_yield and sid_after_yield ~= 0 or \
> {sid_after_yield, sid_before_yield}
>
> box.session.on_disconnect(nil, func)
> +
> +box.schema.user.revoke('guest', 'execute', 'universe')
> --
> 2.21.0 (Apple Git-122.2)
>
next prev parent reply other threads:[~2019-12-04 11:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-03 0:05 Vladislav Shpilevoy
2019-12-04 11:35 ` Alexander Turenko [this message]
2019-12-05 20:42 ` Vladislav Shpilevoy
2019-12-05 22:53 ` Alexander Turenko
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=20191204113537.dqofwyaojalu5jun@tkn_work_nb \
--to=alexander.turenko@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH 1/1] test: fix flaky box/gh-4627-session-use-after-free' \
/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