class StopRequest {
/** @brief Exception launched to kill a process, in order to properly unwind its stack and release RAII stuff
*
- * Nope, Sonar, this should not inherit of std::exception.
+ * Nope, Sonar, this should not inherit of std::exception nor of simgrid::Exception.
* Otherwise, users may accidentally catch it with a try {} catch (std::exception)
*/
+ public:
+ StopRequest() = default;
+ StopRequest(std::string msg) : msg_(msg) { }
+ private:
+ std::string msg_;
};
bool iwannadie;
(*context)();
} catch (StopRequest const&) {
XBT_DEBUG("Caught a StopRequest");
- } catch (simgrid::HostFailureException const&) {
- XBT_DEBUG("Caught an HostFailureException");
+ } catch (simgrid::Exception const& e) {
+ XBT_INFO("Actor killed by an uncatched exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
+ throw e;
}
context->Context::stop();
ASAN_ONLY(context->asan_stop_ = true);
(*context)();
} catch (StopRequest const&) {
XBT_DEBUG("Caught a StopRequest");
- } catch (simgrid::HostFailureException const&) {
- XBT_DEBUG("Caught an HostFailureException");
+ } catch (simgrid::Exception const& e) {
+ XBT_INFO("Actor killed by an uncatched exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
+ throw e;
}
context->Context::stop();
try {
(*context)();
- if (not context->is_maestro()) // really?
- context->Context::stop();
} catch (StopRequest const&) {
XBT_DEBUG("Caught a StopRequest");
xbt_assert(not context->is_maestro(), "I'm not supposed to be maestro here.");
- } catch (simgrid::HostFailureException const&) {
- XBT_DEBUG("Caught an HostFailureException");
+ } catch (simgrid::Exception const& e) {
+ XBT_INFO("Actor killed by an uncatched exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
+ throw e;
}
- if (not context->is_maestro()) // really?
- context->Context::stop();
+ context->Context::stop();
// Signal to the caller (normally the maestro) that we have finished:
context->yield();
(*context)();
} catch (simgrid::kernel::context::Context::StopRequest const&) {
XBT_DEBUG("Caught a StopRequest");
- } catch (simgrid::HostFailureException const&) {
- XBT_DEBUG("Caught an HostFailureException");
+ } catch (simgrid::Exception const& e) {
+ XBT_INFO("Actor killed by an uncatched exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
+ throw e;
}
context->Context::stop();
ASAN_ONLY(context->asan_stop_ = true);
process->suspended_ = false;
process->exception = nullptr;
+ // Forcefully kill the actor if its host is turned off. Not an HostFailureException because you should not survive that
if (process->host_->is_off())
- process->throw_exception(std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed")));
+ process->throw_exception(std::make_exception_ptr(simgrid::kernel::context::Context::StopRequest("Host failed")));
/* destroy the blocking synchro if any */
if (process->waiting_synchro != nullptr) {