render / rpms / libvirt

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