process: wait longer 5->30s on hard shutdown

In cases where virProcessKillPainfully already reailizes that
SIGTERM wasn't enough we are partially on a bad path already.
Maybe the system is overloaded or having serious trouble to free and
reap resources in time.

In those case give the SIGKILL that was sent after 10 seconds some more
time to take effect if force was set (only then we are falling back to
SIGKILL anyway).

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Christian Ehrhardt 2018-08-06 12:10:38 +02:00
parent be2ca04447
commit 9a4e4b942d
No known key found for this signature in database
GPG Key ID: BA3E29338280B242

View File

@ -351,7 +351,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay)
size_t i;
int ret = -1;
/* This is in 1/5th seconds since polling is on a 0.2s interval */
unsigned int polldelay = 75 + (extradelay*5);
unsigned int polldelay = (force ? 200 : 75) + (extradelay*5);
const char *signame = "TERM";
VIR_DEBUG("vpid=%lld force=%d extradelay=%u",
@ -360,7 +360,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay)
/* This loop sends SIGTERM, then waits a few iterations (10 seconds)
* to see if it dies. If the process still hasn't exited, and
* @force is requested, a SIGKILL will be sent, and this will
* wait up to 5 seconds more for the process to exit before
* wait up to 30 seconds more for the process to exit before
* returning.
*
* An extra delay can be passed by the caller for cases that are