25aafc
From 744c445c2b259649afd0f8c715e30d7ae51b35b0 Mon Sep 17 00:00:00 2001
25aafc
Message-Id: <744c445c2b259649afd0f8c715e30d7ae51b35b0@dist-git>
25aafc
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
25aafc
Date: Wed, 4 Dec 2019 16:18:14 +0100
25aafc
Subject: [PATCH] process: wait longer 5->30s on hard shutdown
25aafc
MIME-Version: 1.0
25aafc
Content-Type: text/plain; charset=UTF-8
25aafc
Content-Transfer-Encoding: 8bit
25aafc
25aafc
In cases where virProcessKillPainfully already reailizes that
25aafc
SIGTERM wasn't enough we are partially on a bad path already.
25aafc
Maybe the system is overloaded or having serious trouble to free and
25aafc
reap resources in time.
25aafc
25aafc
In those case give the SIGKILL that was sent after 10 seconds some more
25aafc
time to take effect if force was set (only then we are falling back to
25aafc
SIGKILL anyway).
25aafc
25aafc
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
25aafc
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
25aafc
(cherry picked from commit 9a4e4b942df0474503e7524ea427351a46c0eabe)
25aafc
25aafc
https://bugzilla.redhat.com/show_bug.cgi?id=1771204
25aafc
25aafc
Signed-off-by: Ján Tomko <jtomko@redhat.com>
25aafc
Message-Id: <963a2cb9ac181322394bc475b200b8fc65e1245a.1575472548.git.jtomko@redhat.com>
25aafc
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
25aafc
---
25aafc
 src/util/virprocess.c | 4 ++--
25aafc
 1 file changed, 2 insertions(+), 2 deletions(-)
25aafc
25aafc
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
25aafc
index 297c96a8e5..1085e6cd5d 100644
25aafc
--- a/src/util/virprocess.c
25aafc
+++ b/src/util/virprocess.c
25aafc
@@ -354,7 +354,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay)
25aafc
     size_t i;
25aafc
     int ret = -1;
25aafc
     /* This is in 1/5th seconds since polling is on a 0.2s interval */
25aafc
-    unsigned int polldelay = 75 + (extradelay*5);
25aafc
+    unsigned int polldelay = (force ? 200 : 75) + (extradelay*5);
25aafc
     const char *signame = "TERM";
25aafc
 
25aafc
     VIR_DEBUG("vpid=%lld force=%d extradelay=%u",
25aafc
@@ -363,7 +363,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay)
25aafc
     /* This loop sends SIGTERM, then waits a few iterations (10 seconds)
25aafc
      * to see if it dies. If the process still hasn't exited, and
25aafc
      * @force is requested, a SIGKILL will be sent, and this will
25aafc
-     * wait up to 5 seconds more for the process to exit before
25aafc
+     * wait up to 30 seconds more for the process to exit before
25aafc
      * returning.
25aafc
      *
25aafc
      * An extra delay can be passed by the caller for cases that are
25aafc
-- 
25aafc
2.24.0
25aafc