From 474681b37b04f88b127fcece0c2129f4130db379 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 16 Jul 2018 17:01:07 +0200 Subject: executor: add timeout for akaros --- executor/executor_akaros.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'executor') 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) -- cgit mrf-deployment