From 19594f15ac2bf6ce84492ab7d17b1133aac50bde Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 21 May 2020 11:30:43 +0100 Subject: [PATCH 22/28] shim_waitpid: allow a few retries before throttling retry The retry sleep kicks in too early, allow several retries before throttling back and sleeping per iteration. Makes normnal termination waits more responsive on the waiting parent. Signed-off-by: Colin Ian King --- core-shim.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core-shim.c b/core-shim.c index 5e659f1ebf99..17935f05cdd3 100644 --- a/core-shim.c +++ b/core-shim.c @@ -1184,16 +1184,18 @@ pid_t shim_waitpid(pid_t pid, int *wstatus, int options) if ((ret >= 0) || (errno != EINTR)) break; + count++; /* * Retry if EINTR unless we've have 2 mins * consecutive EINTRs then give up. */ if (!keep_stressing_flag()) { kill(pid, SIGALRM); - if (count++ > 120) + if (count > 120) kill(pid, SIGKILL); } - sleep(1); + if (count > 10) + sleep(1); } return ret; } -- 2.21.3