]> mj.ucw.cz Git - eval.git/commitdiff
Hopefully fixed the occasional "UGH" error.
authorMartin Mares <mj@ucw.cz>
Wed, 29 Apr 2009 10:22:01 +0000 (12:22 +0200)
committerMartin Mares <mj@ucw.cz>
Wed, 29 Apr 2009 10:22:01 +0000 (12:22 +0200)
When the machine creaks under high load, SIGALRM can arrive during the
final wait4() in box_exit(), causing it to return EINTR. Restart waiting
in such cases.

box/box.c

index 69a29173c70d7c4f8ba63b1e5b08e2d8e0b6461e..3f6ada1c1c3e49aa6ee58d2b0b977be00381f58b 100644 (file)
--- a/box/box.c
+++ b/box/box.c
@@ -121,10 +121,12 @@ box_exit(int rc)
       meta_printf("killed:1\n");
 
       struct rusage rus;
-      int stat;
-      int p = wait4(box_pid, &stat, 0, &rus);
+      int p, stat;
+      do
+       p = wait4(box_pid, &stat, 0, &rus);
+      while (p < 0 && errno == EINTR);
       if (p < 0)
-       fprintf(stderr, "UGH: Lost track of the process\n");
+       fprintf(stderr, "UGH: Lost track of the process (%m)\n");
       else
        final_stats(&rus);
     }