[llvm] 9426416 - [llvm-exegesis] Add error handling for fork failures (#65186)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 00:27:19 PDT 2023


Author: Aiden Grossman
Date: 2023-09-08T00:27:15-07:00
New Revision: 942641699432e25023b5a13f63b862d5403185e9

URL: https://github.com/llvm/llvm-project/commit/942641699432e25023b5a13f63b862d5403185e9
DIFF: https://github.com/llvm/llvm-project/commit/942641699432e25023b5a13f63b862d5403185e9.diff

LOG: [llvm-exegesis] Add error handling for fork failures (#65186)

There are still some transient failures on the clang-avx512 builder on
the new subprocess memory tests. Some of them seem to be related to an
inability to fork, but it's hard to debug currently as there is no
explicit error handling for a failed fork call, and nice error reporting
for a failed fork is something that we should have regardless.

Added: 
    

Modified: 
    llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index 2f70822608f5020..7ec24eb2f866f86 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -263,6 +263,12 @@ class SubProcessFunctionExecutorImpl
       return AddMemDefError;
 
     pid_t ParentOrChildPID = fork();
+
+    if (ParentOrChildPID == -1) {
+      return make_error<Failure>("Failed to create child process: " +
+                                 Twine(strerror(errno)));
+    }
+
     if (ParentOrChildPID == 0) {
       // We are in the child process, close the write end of the pipe
       close(PipeFiles[1]);


        


More information about the llvm-commits mailing list