From 5be17ba45c34a0f49c0394c3713f3836ec110f5e Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 26 Aug 2018 11:49:40 +0200 Subject: [PATCH 1/1] Do not throw exception in maestro when host->is_off + sleep() Also, use ActorImpl::throw_exception() instead of messing with its wannabe private exception_ field. --- src/kernel/activity/SleepImpl.cpp | 4 ++-- src/simix/ActorImpl.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kernel/activity/SleepImpl.cpp b/src/kernel/activity/SleepImpl.cpp index 2809eeb8de..f9c159b8c2 100644 --- a/src/kernel/activity/SleepImpl.cpp +++ b/src/kernel/activity/SleepImpl.cpp @@ -37,8 +37,8 @@ void simgrid::kernel::activity::SleepImpl::post() /* If the host running the synchro failed, notice it. This way, the asking * actor can be killed if it runs on that host itself */ result = SIMIX_SRC_HOST_FAILURE; - simcall->issuer->exception = - std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed")); + simcall->issuer->throw_exception( + std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"))); } switch (surf_sleep->get_state()) { diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index dad7703083..4ee0c20f64 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -229,8 +229,8 @@ void ActorImpl::resume() smx_activity_t ActorImpl::sleep(double duration) { if (host_->is_off()) - throw new simgrid::HostFailureException(XBT_THROW_POINT, - std::string("Host ") + std::string(host_->get_cname())+" failed, you cannot sleep there."); + throw_exception(std::make_exception_ptr(simgrid::HostFailureException( + XBT_THROW_POINT, std::string("Host ") + std::string(host_->get_cname()) + " failed, you cannot sleep there."))); simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl(); synchro->host = host_; @@ -501,7 +501,7 @@ void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) { /* destroy the blocking synchro if any */ if (process->waiting_synchro != nullptr) { if (process->host_->is_off()) - process->exception = std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed")); + process->throw_exception(std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"))); simgrid::kernel::activity::ExecImplPtr exec = boost::dynamic_pointer_cast(process->waiting_synchro); simgrid::kernel::activity::CommImplPtr comm = -- 2.20.1