Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branches 'auto_restart' and 'auto_restart' of framagit.org:simgrid/simgrid
[simgrid.git] / src / simix / ActorImpl.cpp
index 6aa8dfa..8c60d57 100644 (file)
@@ -450,7 +450,9 @@ 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()) {
+      SMX_EXCEPTION(process, host_error, 0, "Host failed");
+    }
     simgrid::kernel::activity::ExecImplPtr exec =
         boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(process->waiting_synchro);
     simgrid::kernel::activity::CommImplPtr comm =
@@ -483,7 +485,7 @@ void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) {
       SIMIX_synchro_stop_waiting(process, &process->simcall);
 
     } else if (io != nullptr) {
-      SIMIX_io_destroy(process->waiting_synchro);
+      delete io.get();
     } else {
       xbt_die("Unknown type of activity");
     }
@@ -547,7 +549,7 @@ void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const
     simgrid::kernel::activity::IoImplPtr io =
         boost::dynamic_pointer_cast<simgrid::kernel::activity::IoImpl>(process->waiting_synchro);
     if (io != nullptr) {
-      SIMIX_io_destroy(process->waiting_synchro);
+      delete io.get();
     }
   }
   process->waiting_synchro = nullptr;
@@ -698,10 +700,14 @@ void SIMIX_process_yield(smx_actor_t self)
     self->finished_ = true;
     /* execute the on_exit functions */
     SIMIX_process_on_exit_runall(self);
-    /* Add the process to the list of process to restart, only if the host is down */
-    if (self->auto_restart_ && self->host_->is_off()) {
-      SIMIX_host_add_auto_restart_process(self->host_, self);
+
+    if (self->auto_restart_ && self->host_->is_off() &&
+        watched_hosts.find(self->host_->get_cname()) == watched_hosts.end()) {
+      XBT_DEBUG("Push host %s to watched_hosts because it's off and %s needs to restart", self->host_->get_cname(),
+                self->get_cname());
+      watched_hosts.insert(self->host_->get_cname());
     }
+
     XBT_DEBUG("Process %s@%s is dead", self->get_cname(), self->host_->get_cname());
     self->context_->stop();
   }