Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
actors on failing hosts should die silently and with no delay
[simgrid.git] / src / kernel / activity / CommImpl.cpp
index 5af5025..8079463 100644 (file)
@@ -273,7 +273,7 @@ void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activi
   }
 
   for (std::size_t i = 0; i != count; ++i) {
-    simgrid::kernel::activity::ActivityImplPtr comm = comms[i];
+    simgrid::kernel::activity::CommImpl* comm = comms[i];
     if (comm->state_ != SIMIX_WAITING && comm->state_ != SIMIX_RUNNING) {
       simcall_comm_testany__set__result(simcall, i);
       comm->simcalls_.push_back(simcall);
@@ -377,7 +377,8 @@ CommImpl::CommImpl(CommImpl::Type type) : type(type)
 
 CommImpl::~CommImpl()
 {
-  XBT_DEBUG("Really free communication %p", this);
+  XBT_DEBUG("Really free communication %p in state %d (detached = %d)", this, static_cast<int>(state_),
+            static_cast<int>(detached));
 
   cleanupSurf();
 
@@ -387,10 +388,9 @@ CommImpl::~CommImpl()
     if (clean_fun)
       clean_fun(src_buff_);
     src_buff_ = nullptr;
-  }
-
-  if (mbox)
+  } else if (mbox) {
     mbox->remove(this);
+  }
 }
 
 /**  @brief Starts the simulation of a communication synchro. */
@@ -485,8 +485,10 @@ void CommImpl::cancel()
 {
   /* if the synchro is a waiting state means that it is still in a mbox so remove from it and delete it */
   if (state_ == SIMIX_WAITING) {
-    mbox->remove(this);
-    state_ = SIMIX_CANCELED;
+    if (not detached) {
+      mbox->remove(this);
+      state_ = SIMIX_CANCELED;
+    }
   } else if (not MC_is_active() /* when running the MC there are no surf actions */
              && not MC_record_replay_is_active() && (state_ == SIMIX_READY || state_ == SIMIX_RUNNING)) {
     surf_action_->cancel();
@@ -583,8 +585,6 @@ void CommImpl::finish()
 
     if (not simcall->issuer->get_host()->is_on()) {
       simcall->issuer->context_->iwannadie = true;
-      simcall->issuer->exception_ =
-          std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"));
     } else {
       switch (state_) {