aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-07-16 17:01:07 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-07-16 17:01:07 +0200
commit474681b37b04f88b127fcece0c2129f4130db379 (patch)
tree30d939fe267965af846a1429f8100842796236f3 /executor
parent7cfcfa6a735a431916399d140a77c1b289a607ff (diff)
executor: add timeout for akaros
Diffstat (limited to 'executor')
-rw-r--r--executor/executor_akaros.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/executor/executor_akaros.cc b/executor/executor_akaros.cc
index 3f0ffb5a8..76006b513 100644
--- a/executor/executor_akaros.cc
+++ b/executor/executor_akaros.cc
@@ -46,8 +46,20 @@ int main(int argc, char** argv)
fail("execl failed");
return 0;
}
+
int status = 0;
- while (waitpid(pid, &status, 0) != pid) {
+ uint64 start = current_time_ms();
+ for (;;) {
+ int res = waitpid(-1, &status, WNOHANG);
+ if (res == pid)
+ break;
+ usleep(1000);
+ if (current_time_ms() - start < 6 * 1000)
+ continue;
+ kill(pid, SIGKILL);
+ while (waitpid(-1, &status, 0) != pid) {
+ }
+ break;
}
status = WEXITSTATUS(status);
if (status == kFailStatus)