aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-09-27 00:18:05 +0200
committerest31 <MTest31@outlook.com>2015-09-27 00:27:36 +0200
commite7282816fffc433861e7e83b0bf1de701d3ea2d1 (patch)
treedee6fe705a7832aa6a41c41314dd8035a34c8fa1 /src
parent4338f100f84100f5779d4e12fe23d359f94ef718 (diff)
downloadminetest-e7282816fffc433861e7e83b0bf1de701d3ea2d1.tar.gz
minetest-e7282816fffc433861e7e83b0bf1de701d3ea2d1.tar.bz2
minetest-e7282816fffc433861e7e83b0bf1de701d3ea2d1.zip
Abort at uncatched exceptions
Change a remaining assert(0) call to FATAL_ERROR(msg). There was a regression since commit ced6d20295a8263757d57c02a07ffcb66688a163 "For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives" where when an "uncatched" exception is thrown inside a "side thread", the program doesn't abort anymore. This led to the problem @netinetwalker experienced where the emergethread got an unhandled exception for loading a mapblock while redis was loading, (see #3196) and then jmped outside its loop to work down its queue. This resulted in the server not doing any emerges anymore.
Diffstat (limited to 'src')
-rw-r--r--src/debug.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/debug.h b/src/debug.h
index 9684aa2df..2ccbe58ba 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -42,7 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#endif
// Whether to catch all std::exceptions.
-// Assert will be called on such an event.
+// When "catching", the program will abort with an error message.
// In debug mode, leave these for the debugger and don't catch them.
#ifdef NDEBUG
#define CATCH_UNHANDLED_EXCEPTIONS 1
@@ -145,11 +145,11 @@ private:
#if CATCH_UNHANDLED_EXCEPTIONS == 1
#define BEGIN_DEBUG_EXCEPTION_HANDLER try {
- #define END_DEBUG_EXCEPTION_HANDLER(logstream) \
- } catch (std::exception &e) { \
- logstream << "ERROR: An unhandled exception occurred: " \
- << e.what() << std::endl; \
- assert(0); \
+ #define END_DEBUG_EXCEPTION_HANDLER(logstream) \
+ } catch (std::exception &e) { \
+ logstream << "An unhandled exception occurred: " \
+ << e.what() << std::endl; \
+ FATAL_ERROR(e.what()); \
}
#else
// Dummy ones