render / rpms / libvirt

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