summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
81ee7d3)
and when I want to really kill an actor (eg when its host is turned
off), I launch an uncatchable kernel::Context::StopRequest instead of
a catchable simgrid::HostFailureException (which will be used in case
of remote exec and similar)
Maybe there should be a config flag to decide if we want to kill the
simulation when an actor fails. The current setting forces the user to
add try/catch (simgrid::Exception) around their main functions. That's
not a bad thing either, not sure.
class StopRequest {
/** @brief Exception launched to kill a process, in order to properly unwind its stack and release RAII stuff
*
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)
*/
* 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_;
(*context)();
} catch (StopRequest const&) {
XBT_DEBUG("Caught a StopRequest");
(*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->Context::stop();
ASAN_ONLY(context->asan_stop_ = true);
(*context)();
} catch (StopRequest const&) {
XBT_DEBUG("Caught a StopRequest");
(*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();
}
context->Context::stop();
- 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 (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();
// 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");
(*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);
}
context->Context::stop();
ASAN_ONLY(context->asan_stop_ = true);
process->suspended_ = false;
process->exception = nullptr;
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())
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) {
/* destroy the blocking synchro if any */
if (process->waiting_synchro != nullptr) {