Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v1] tarantoolctl fails to stop server
@ 2020-08-16 20:41 Alexander V. Tikhonov
  0 siblings, 0 replies; only message in thread
From: Alexander V. Tikhonov @ 2020-08-16 20:41 UTC (permalink / raw)
  To: Kirill Yukhin, Alexander Turenko; +Cc: tarantool-patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-16 20:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-16 20:41 [Tarantool-patches] [PATCH v1] tarantoolctl fails to stop server Alexander V. Tikhonov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox