From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <tarantool-patches-bounce@freelists.org>
Received: from localhost (localhost [127.0.0.1])
	by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 53968270AA
	for <tarantool-patches@freelists.org>; Wed, 18 Jul 2018 01:34:39 -0400 (EDT)
Received: from turing.freelists.org ([127.0.0.1])
	by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 8T3umcu13wRd for <tarantool-patches@freelists.org>;
	Wed, 18 Jul 2018 01:34:39 -0400 (EDT)
Received: from smtp52.i.mail.ru (smtp52.i.mail.ru [94.100.177.112])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 90FC22709E
	for <tarantool-patches@freelists.org>; Wed, 18 Jul 2018 01:34:38 -0400 (EDT)
Date: Wed, 18 Jul 2018 08:19:53 +0300
From: Konstantin Osipov <kostja@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH] tarantoolctl: return an error on
 enter to a dead socket.
Message-ID: <20180718051953.GA31091@chai>
References: <20180716082655.42311-1-sergepetrenko@tarantool.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20180716082655.42311-1-sergepetrenko@tarantool.org>
Sender: tarantool-patches-bounce@freelists.org
Errors-to: tarantool-patches-bounce@freelists.org
Reply-To: tarantool-patches@freelists.org
List-help: <mailto:ecartis@freelists.org?Subject=help>
List-unsubscribe: <tarantool-patches-request@freelists.org?Subject=unsubscribe>
List-software: Ecartis version 1.0.0
List-Id: tarantool-patches <tarantool-patches.freelists.org>
List-subscribe: <tarantool-patches-request@freelists.org?Subject=subscribe>
List-owner: <mailto:>
List-post: <mailto:tarantool-patches@freelists.org>
List-archive: <http://www.freelists.org/archives/tarantool-patches>
To: tarantool-patches@freelists.org
Cc: Serge Petrenko <sergepetrenko@tarantool.org>

* Serge Petrenko <sergepetrenko@tarantool.org> [18/07/16 15:14]:

> Tarantoolctl enter didn't check whether connection to a socket was established
> if a socket file existed. It just executed a local console.
> Fix this by adding a check and an error, also add a test case.
> 
> Closes #3364

>  extra/dist/tarantoolctl.in         | 19 ++++++++++++-------
>  test/app-tap/tarantoolctl.test.lua | 29 ++++++++++++++++++++++++++++-
>  2 files changed, 40 insertions(+), 8 deletions(-)
> 
> +    local status, err = pcall(function()
> +        test:test("check error codes in case of enter", function(test_i)
> +            test_i:plan(6)
> +            check_ok(test_i, dir, 'enter', 'script', 1, nil, "Can't connect to")
> +            check_ok(test_i, dir, 'start', 'script', 0)
> +            os.execute(("kill $(cat %s/script.pid)"):format(dir))

I don't understand how this works. Simply sending
SIGTERM to tarantool would should it down gracefully and remove
the socket. If it doesn't, it's a bug. You should use SIGKILL if
you wanted to create a dead socket. But then again why do you need
to start an instance in order to get a dead socket? Can't you make
it simpler and create a dead socket with fio API?

> +            check_ok(test_i, dir, 'enter', 'script', 1, nil, "Can't connect to")
> +            check_ok(test_i, dir, 'stop','script', 0)
> +        end)
> +    end)

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov