Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
run Actor::on_destruction even if the actor was killed before starting, but not on...
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 2 Aug 2019 16:55:49 +0000 (18:55 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 2 Aug 2019 16:56:08 +0000 (18:56 +0200)
It seems that the actors are sometimes killed after the simix_global
destruction... Maybe when the user code keeps a reference on them.

src/kernel/actor/ActorImpl.cpp

index 992ab56..0db52ef 100644 (file)
@@ -61,10 +61,12 @@ ActorImpl::ActorImpl(const simgrid::xbt::string& name, s4u::Host* host) : host_(
 
 ActorImpl::~ActorImpl()
 {
-  if (this != simix_global->maestro_process) {
-    context_->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops
+  if (simix_global != nullptr && this != simix_global->maestro_process) {
+    if (context_.get() != nullptr) /* the actor was not start()ed yet. This happens if its host was initially off */
+      context_->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops
     simgrid::simix::simcall([this] { simgrid::s4u::Actor::on_destruction(*ciface()); });
-    context_->iwannadie = true;
+    if (context_.get() != nullptr)
+      context_->iwannadie = true;
   }
 }