From fc558d3946d292c36c603e077e629ba0e7111983 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Mon, 1 Mar 2021 14:34:41 +0000 Subject: [PATCH] fix #5059: exit straight away on hard timeout dont run atexit handlers as its not safe to do so with multiple threads code might be inside malloc, for example, and glibc tries to cleanup its heap state with an atexit handler --- src/shell/datalog_frontend.cpp | 2 +- src/shell/dimacs_frontend.cpp | 2 +- src/shell/lp_frontend.cpp | 2 +- src/shell/opt_frontend.cpp | 2 +- src/shell/smtlib_frontend.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/shell/datalog_frontend.cpp b/src/shell/datalog_frontend.cpp index cb289f868..b3dfbc78a 100644 --- a/src/shell/datalog_frontend.cpp +++ b/src/shell/datalog_frontend.cpp @@ -109,7 +109,7 @@ static void display_statistics() { static void on_timeout() { display_statistics(); - exit(0); + _Exit(0); } static void STD_CALL on_ctrl_c(int) { diff --git a/src/shell/dimacs_frontend.cpp b/src/shell/dimacs_frontend.cpp index 9bc723f82..f11f9dc56 100644 --- a/src/shell/dimacs_frontend.cpp +++ b/src/shell/dimacs_frontend.cpp @@ -55,7 +55,7 @@ static void display_statistics() { static void on_timeout() { display_statistics(); - exit(0); + _Exit(0); } static void STD_CALL on_ctrl_c(int) { diff --git a/src/shell/lp_frontend.cpp b/src/shell/lp_frontend.cpp index 8f6e6a242..0234e61b4 100644 --- a/src/shell/lp_frontend.cpp +++ b/src/shell/lp_frontend.cpp @@ -38,7 +38,7 @@ static void STD_CALL on_ctrl_c(int) { static void on_timeout() { display_statistics(); - exit(0); + _Exit(0); } struct front_end_resource_limit : public lp::lp_resource_limit { diff --git a/src/shell/opt_frontend.cpp b/src/shell/opt_frontend.cpp index 897b411d1..0e5806ec0 100644 --- a/src/shell/opt_frontend.cpp +++ b/src/shell/opt_frontend.cpp @@ -84,7 +84,7 @@ static void STD_CALL on_ctrl_c(int) { static void on_timeout() { display_statistics(); - exit(0); + _Exit(0); } static unsigned parse_opt(std::istream& in, opt_format f) { diff --git a/src/shell/smtlib_frontend.cpp b/src/shell/smtlib_frontend.cpp index f63b0f2df..c86d4b5b9 100644 --- a/src/shell/smtlib_frontend.cpp +++ b/src/shell/smtlib_frontend.cpp @@ -62,7 +62,7 @@ static void display_model() { static void on_timeout() { display_statistics(); - exit(0); + _Exit(0); } static void STD_CALL on_ctrl_c(int) {