From: Vladimir Davydov <vdavydov.dev@gmail.com> To: Serge Petrenko <sergepetrenko@tarantool.org> Cc: tarantool-patches@freelists.org Subject: Re: [PATCH] test: fix app-tap/tarantoolctl sporadic failure Date: Thu, 16 Aug 2018 22:42:31 +0300 [thread overview] Message-ID: <20180816194231.rgvalwtc7laimqai@esperanza> (raw) In-Reply-To: <20180816152400.4237-1-sergepetrenko@tarantool.org> On Thu, Aug 16, 2018 at 06:24:00PM +0300, Serge Petrenko wrote: > In rare cases this test failed on `tarantoolctl status` after > `tarantoolctl stop` due to `tarantoolctl stop` taking too much time to > unlink pid file. This is too vague for an explanation. AFAIU the problem here is that the pid file is deleted by tarantool (from tarantool_free => pidfile_remove) while the control socket file is deleted by tarantoolctl so if `tarantoolctl status` is called immediately after `tarantoolctl stop`, there's a chance tarantool hasn't exited yet and so the pid file still exists. Please update the comment. > Fix this by waiting for pid file deletion in test. > > Closes #3557 > --- > https://github.com/tarantool/tarantool/issues/3557 > https://github.com/tarantool/tarantool/tree/sp/gh-3557-tarantoolctl-test-fix > > > test/app-tap/tarantoolctl.test.lua | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua > index 6946c8312..83a8bfc37 100755 > --- a/test/app-tap/tarantoolctl.test.lua > +++ b/test/app-tap/tarantoolctl.test.lua > @@ -34,6 +34,13 @@ local function recursive_rmdir(path) > end > end > > +local function wait_delete(path) > + path = fio.abspath(path) You don't need to call abspath here. > + while fio.path.exists(path) do > + fiber.sleep(0.0001) A tab! Please fix your editor. Also, please use fiber.sleep(0.01) for consistency with other timeouts used in this script. > + end > +end > + There's tctl_wait() helper that waits for tarantool to start. Let's rename it to tctl_wait_start() and introduce tctl_wait_stop() with the same signature that would wait for tarantool to stop. > ffi.cdef[[ > typedef int32_t pid_t; > int kill(pid_t pid, int sig); > @@ -157,6 +164,7 @@ test:plan(6) > do > local dir = fio.tempdir() > local code = [[ box.cfg{memtx_memory = 104857600} ]] > + local pid_path = fio.pathjoin(dir, 'script.pid') > create_script(dir, 'script.lua', code) > > local status, err = pcall(function() > @@ -168,6 +176,7 @@ do > check_ok(test_i, dir, 'start', 'script', 1, nil, "is already running") > check_ok(test_i, dir, 'status', 'script', 0, nil, "is running") > check_ok(test_i, dir, 'stop', 'script', 0, nil, "Stopping") > + wait_delete(pid_path) > check_ok(test_i, dir, 'status', 'script', 1, nil, "is stopped") > check_ok(test_i, dir, 'stop', 'script', 0, nil, "is not running") > check_ok(test_i, dir, 'status', 'script', 1, nil, "is stopped" )
next prev parent reply other threads:[~2018-08-16 19:42 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-08-16 15:24 Serge Petrenko 2018-08-16 19:42 ` Vladimir Davydov [this message] 2018-08-17 6:47 ` [tarantool-patches] " Serge Petrenko 2018-08-17 8:32 ` Vladimir Davydov
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=20180816194231.rgvalwtc7laimqai@esperanza \ --to=vdavydov.dev@gmail.com \ --cc=sergepetrenko@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [PATCH] test: fix app-tap/tarantoolctl sporadic failure' \ /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