Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
To: Kirill Yukhin <kyukhin@tarantool.org>,
	Alexander Turenko <alexander.turenko@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v1] tarantoolctl fails to stop server
Date: Sun, 16 Aug 2020 23:41:38 +0300	[thread overview]
Message-ID: <a0a5a0d528ae82268c7864f9a16e373beacbc6a4.1597610452.git.avtikhon@tarantool.org> (raw)

When server process couldn't be stopped with SIGTERM as described in
[1], then tarantoolctl didn't check its status and returned success
exit code. To fix it, check of the process after SIGTERM send should
be added and if the process was still alive than it should be killed
with SIGKILL. Also some time delay added before the process status
check to be sure that it completely gone.

Closed #5245

[1] - https://github.com/tarantool/tarantool/issues/5244
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-5245-tarantoolctl-kills
Issue: https://github.com/tarantool/tarantool/issues/5244

 extra/dist/tarantoolctl.in | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in
index 90caf58ad..7bf3808f8 100755
--- a/extra/dist/tarantoolctl.in
+++ b/extra/dist/tarantoolctl.in
@@ -600,6 +600,15 @@ local function stop()
         fio.unlink(pid_file)
         return 1
     end
+    fiber.sleep(1)
+    if fio.stat(pid_file) ~= nil then
+        log.info("Kill not terminated process %d", pid)
+        if ffi.C.kill(pid, 9) < 0 then
+            log.error("Can't kill process %d: %s", pid, errno.strerror())
+            fio.unlink(pid_file)
+            return 1
+        end
+    end
 
     return 0
 end
-- 
2.17.1

                 reply	other threads:[~2020-08-16 20:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=a0a5a0d528ae82268c7864f9a16e373beacbc6a4.1597610452.git.avtikhon@tarantool.org \
    --to=avtikhon@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1] tarantoolctl fails to stop server' \
    /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