Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
We don't want to survive a ForcefulKillException!
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 27 Apr 2021 17:00:25 +0000 (19:00 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 27 Apr 2021 19:13:47 +0000 (21:13 +0200)
src/xbt/exception.cpp

index 4ded329..8b9c3d3 100644 (file)
@@ -104,28 +104,24 @@ static void handler()
   // We manage C++ exception ourselves
   catch (const std::exception& e) {
     log_exception(xbt_log_priority_critical, "Uncaught exception", e);
-    show_backtrace(bt);
-    std::abort();
   }
 
   catch (const simgrid::ForcefulKillException&) {
     XBT_ERROR("Received a ForcefulKillException at the top-level exception handler. Maybe a Java->C++ call that is not "
               "protected in a try/catch?");
-    show_backtrace(bt);
   }
 
   // We don't know how to manage other exceptions
   catch (...) {
     // If there was another handler let's delegate to it
-    if (previous_terminate_handler)
+    if (previous_terminate_handler) {
       previous_terminate_handler();
-    else {
-      XBT_ERROR("Unknown uncaught exception");
-      show_backtrace(bt);
-      std::abort();
+      XBT_ERROR("Unexpected return from delegated terminate handler");
     }
+    XBT_ERROR("Unknown uncaught exception");
   }
-  XBT_INFO("BAM");
+  show_backtrace(bt);
+  std::abort();
 }
 
 void install_exception_handler()