main: handle exceptions during startup

If we don't, std::terminate() causes a core dump, even though an
exception is sort-of-expected here and can be handled.

Add an exception handler to fix.

Fixes #1379.
Message-Id: <1466595221-20358-1-git-send-email-avi@scylladb.com>
This commit is contained in:
Avi Kivity
2016-06-22 14:33:41 +03:00
committed by Pekka Enberg
parent a192c80377
commit 5af22f6cb1

View File

@@ -278,6 +278,7 @@ verify_seastar_io_scheduler(bool has_max_io_requests, bool developer_mode) {
}
int main(int ac, char** av) {
try {
// early check to avoid triggering
if (!cpu_sanity()) {
_exit(71);
@@ -626,6 +627,11 @@ int main(int ac, char** av) {
});
}).or_terminate();
});
} catch (...) {
// reactor may not have been initialized, so can't use logger
fprint(std::cerr, "FATAL: Exception during startup, aborting: %s\n", std::current_exception());
return 7; // 1 has a special meaning for upstart
}
}
namespace debug {