Skip to content

Commit 9426416

Browse files
[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.
1 parent d9efcb5 commit 9426416

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ class SubProcessFunctionExecutorImpl
263263
return AddMemDefError;
264264

265265
pid_t ParentOrChildPID = fork();
266+
267+
if (ParentOrChildPID == -1) {
268+
return make_error<Failure>("Failed to create child process: " +
269+
Twine(strerror(errno)));
270+
}
271+
266272
if (ParentOrChildPID == 0) {
267273
// We are in the child process, close the write end of the pipe
268274
close(PipeFiles[1]);

0 commit comments

Comments
 (0)