diff options
author | George Burgess IV <gbiv@google.com> | 2021-01-25 09:55:03 -0800 |
---|---|---|
committer | George Burgess <gbiv@chromium.org> | 2021-01-29 17:39:12 +0000 |
commit | 77a0c2073a603ce6698f3667036e62a572cbb37c (patch) | |
tree | 29683073c9fe56cee15a9bedbac7cf2783e1d454 /compiler_wrapper | |
parent | de5be1615b374561c4fca247ecc6f999837ce6ac (diff) | |
download | toolchain-utils-77a0c2073a603ce6698f3667036e62a572cbb37c.tar.gz |
compiler_wrapper: loop in exec on ERESTARTSYS
Very rarely on old GCCs, we'll see an ERESTARTSYS that fails builders.
Kernel documentation indicates that users should never see ERESTARTSYS,
but it's unclear how to fix this, so try to work around it for now.
BUG=chromium:1166017
TEST=CQ
Change-Id: I5a1ca6ce722f929523feb45aeafffcc30dfda05a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2647869
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Tested-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper')
-rw-r--r-- | compiler_wrapper/libc_exec.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/compiler_wrapper/libc_exec.go b/compiler_wrapper/libc_exec.go index d9867733..09f8be85 100644 --- a/compiler_wrapper/libc_exec.go +++ b/compiler_wrapper/libc_exec.go @@ -18,7 +18,19 @@ package main // // Since fork() brings us to one thread, we can only use async-signal-safe funcs below. // pid_t pid = fork(); // if (pid == 0) { -// execve(pathname, argv, envp); +// // crbug.com/1166017: we're (very rarely) getting ERESTARTSYS on some builders. +// // Documentation indicates that this is a bug in the kernel. Work around it by +// // retrying. 25 is an arbitrary retry number that Should Be Enough For Anyone(TM). +// for (int i = 0; i < 25; i++) { +// execve(pathname, argv, envp); +// if (errno != 512) { +// break; +// } +// // Sleep a bit. Not sure if this helps, but if the condition we're seeing is +// // transient, it *hopefully* should. nanosleep isn't async-signal safe, so +// // we have to live with sleep() +// sleep(1); +// } // fprintf(stderr, "exec failed (errno: %d)\n", errno); // _exit(1); // } |