classify SIGSEV/SIGBUS as infinite recursion errors

This commit is contained in:
Jörg Thalheim 2023-12-16 11:53:10 +01:00
parent 093b8ce5cc
commit b73f7ceff4

View file

@ -126,17 +126,34 @@ void handleBrokenWorkerPipe(Proc &proc, std::string_view msg) {
if (WEXITSTATUS(status) == 1) { if (WEXITSTATUS(status) == 1) {
throw Error( throw Error(
"while %s, evaluation worker exited with exit code 1, " "while %s, evaluation worker exited with exit code 1, "
"(possibly an infinite recursion)", "(possible infinite recursion)",
msg); msg);
} }
throw Error("while %s, evaluation worker exited with %d", msg, throw Error("while %s, evaluation worker exited with %d", msg,
WEXITSTATUS(status)); WEXITSTATUS(status));
} else if (WIFSIGNALED(status)) { } else if (WIFSIGNALED(status)) {
if (WTERMSIG(status) == SIGKILL) { switch (WTERMSIG(status)) {
throw Error("while %s, evaluation worker got killed by " case SIGKILL:
"SIGKILL, maybe " throw Error(
"memory limit reached?", "while %s, evaluation worker got killed by SIGKILL, "
msg); "maybe "
"memory limit reached?",
msg);
break;
#ifdef __APPLE__
case SIGBUS:
throw Error(
"while %s, evaluation worker got killed by SIGBUS, "
"(possible infinite recursion)",
msg);
break;
#else
case SIGSEGV:
throw Error(
"while %s, evaluation worker got killed by SIGSEGV, "
"(possible infinite recursion)",
msg);
#endif
} }
throw Error( throw Error(
"while %s, evaluation worker got killed by signal %d (%s)", "while %s, evaluation worker got killed by signal %d (%s)",