1 /* Copyright (c) 2016-2023. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include <simgrid/Exception.hpp>
7 #include <simgrid/kernel/Timer.hpp>
8 #include <simgrid/kernel/routing/NetPoint.hpp>
9 #include <simgrid/kernel/routing/NetZoneImpl.hpp>
10 #include <simgrid/s4u/Host.hpp>
11 #include <simgrid/sg_config.hpp>
14 #include "simgrid/math_utils.h"
15 #include "src/kernel/EngineImpl.hpp"
16 #include "src/kernel/resource/StandardLinkImpl.hpp"
17 #include "src/kernel/resource/profile/Profile.hpp"
18 #include "src/kernel/xml/platf.hpp"
19 #include "src/mc/mc_record.hpp"
20 #include "src/mc/mc_replay.hpp"
21 #include "src/smpi/include/smpi_actor.hpp"
22 #include "src/surf/surf_interface.hpp"
23 #include "xbt/module.h"
24 #include "xbt/xbt_modinter.h" /* whether initialization was already done */
26 #include <boost/algorithm/string/predicate.hpp>
30 #include "src/mc/remote/AppSide.hpp"
33 XBT_LOG_NEW_DEFAULT_CATEGORY(ker_engine, "Logging specific to Engine (kernel)");
35 namespace simgrid::kernel {
36 double EngineImpl::now_ = 0.0;
37 EngineImpl* EngineImpl::instance_ = nullptr; /* That singleton is awful too. */
39 config::Flag<double> cfg_breakpoint{"debug/breakpoint",
40 "When non-negative, raise a SIGTRAP after given (simulated) time", -1.0};
41 config::Flag<bool> cfg_verbose_exit{"debug/verbose-exit", "Display the actor status at exit", true};
43 constexpr std::initializer_list<std::pair<const char*, context::ContextFactory* (*)()>> context_factories = {
45 {"raw", &context::raw_factory},
47 #if HAVE_UCONTEXT_CONTEXTS
48 {"ucontext", &context::sysv_factory},
50 #if HAVE_BOOST_CONTEXTS
51 {"boost", &context::boost_factory},
53 {"thread", &context::thread_factory},
56 static_assert(context_factories.size() > 0, "No context factories are enabled for this build");
58 // Create the list of possible contexts:
59 static inline std::string contexts_list()
63 for (auto const& [factory_name, _] : context_factories) {
64 res += sep + factory_name;
70 static config::Flag<std::string> context_factory_name("contexts/factory",
71 ("Possible values: " + contexts_list()).c_str(),
72 context_factories.begin()->first);
74 } // namespace simgrid::kernel
76 XBT_ATTRIB_NORETURN static void inthandler(int)
78 if (simgrid::kernel::cfg_verbose_exit) {
79 XBT_INFO("CTRL-C pressed. The current status will be displayed before exit (disable that behavior with option "
80 "'debug/verbose-exit').");
81 simgrid::kernel::EngineImpl::get_instance()->display_all_actor_status();
83 XBT_INFO("CTRL-C pressed, exiting. Hiding the current process status since 'debug/verbose-exit' is set to false.");
88 static void segvhandler(int signum, siginfo_t* siginfo, void* /*context*/)
90 if ((siginfo->si_signo == SIGSEGV && siginfo->si_code == SEGV_ACCERR) || siginfo->si_signo == SIGBUS) {
92 "Access violation or Bus error detected.\n"
93 "This probably comes from a programming error in your code, or from a stack\n"
94 "overflow. If you are certain of your code, try increasing the stack size\n"
95 " --cfg=contexts/stack-size:XXX (current size is %u KiB).\n"
97 "If it does not help, this may have one of the following causes:\n"
98 "a bug in SimGrid, a bug in the OS or a bug in a third-party libraries.\n"
99 "Failing hardware can sometimes generate such errors too.\n"
101 "If you think you've found a bug in SimGrid, please report it along with a\n"
102 "Minimal Working Example (MWE) reproducing your problem and a full backtrace\n"
103 "of the fault captured with gdb or valgrind.\n",
104 simgrid::kernel::context::Context::stack_size / 1024);
105 } else if (siginfo->si_signo == SIGSEGV) {
106 fprintf(stderr, "Segmentation fault.\n");
108 if (SMPI_is_inited() && smpi_cfg_privatization() == SmpiPrivStrategies::NONE) {
109 #if HAVE_PRIVATIZATION
110 fprintf(stderr, "Try to enable SMPI variable privatization with --cfg=smpi/privatization:yes.\n");
112 fprintf(stderr, "Sadly, your system does not support --cfg=smpi/privatization:yes (yet).\n");
113 #endif /* HAVE_PRIVATIZATION */
115 #endif /* HAVE_SMPI */
120 static void install_signal_handlers()
122 /* Install signal handler for SIGINT */
123 std::signal(SIGINT, inthandler);
125 /* Install signal handler for SIGSEGV */
126 if (simgrid::kernel::context::Context::install_sigsegv_stack(true) == -1) {
127 XBT_WARN("Failed to register alternate signal stack: %s", strerror(errno));
131 struct sigaction action;
132 action.sa_sigaction = &segvhandler;
133 action.sa_flags = SA_ONSTACK | SA_RESETHAND | SA_SIGINFO;
134 sigemptyset(&action.sa_mask);
136 /* Linux tend to raise only SIGSEGV where other systems also raise SIGBUS on severe error */
137 for (int sig : {SIGSEGV, SIGBUS}) {
138 if (sigaction(sig, &action, nullptr) == -1)
139 XBT_WARN("Failed to register signal handler for signal %d: %s", sig, strerror(errno));
143 namespace simgrid::kernel {
145 EngineImpl::~EngineImpl()
147 /* Also delete the other data */
148 delete netzone_root_;
149 for (auto const& [_, netpoint] : netpoints_)
152 for (auto const& [_, mailbox] : mailboxes_)
155 /* Kill all actors (but maestro) */
156 maestro_->kill_all();
161 delete context_factory_;
163 /* clear models before freeing handle, network models can use external callback defined in the handle */
164 models_prio_.clear();
167 void EngineImpl::initialize(int* argc, char** argv)
169 xbt_assert(EngineImpl::instance_ == nullptr,
170 "It is currently forbidden to create more than one instance of kernel::EngineImpl");
171 EngineImpl::instance_ = this;
173 // The communication initialization is done ASAP, as we need to get some init parameters from the MC for different
174 // layers. But instance_ needs to be created, as we send the address of some of its fields to the MC that wants to
175 // read them directly.
176 simgrid::mc::AppSide::initialize();
179 if (xbt_initialized == 0) {
180 xbt_init(argc, argv);
182 sg_config_init(argc, argv);
185 instance_->context_mod_init();
187 install_signal_handlers();
189 /* register a function to be called by SURF after the environment creation */
190 s4u::Engine::on_platform_created_cb([this]() { this->presolve(); });
192 if (config::get_value<bool>("debug/clean-atexit"))
196 void EngineImpl::context_mod_init() const
198 xbt_assert(not instance_->has_context_factory());
200 #if HAVE_SMPI && defined(__NetBSD__)
201 smpi_init_options_internal(false);
202 std::string priv = config::get_value<std::string>("smpi/privatization");
203 if (context_factory_name == "thread" && (priv == "dlopen" || priv == "yes" || priv == "default" || priv == "1")) {
204 XBT_WARN("dlopen+thread broken on Apple and BSD. Switching to raw contexts.");
205 context_factory_name = "raw";
209 #if HAVE_SMPI && defined(__FreeBSD__)
210 smpi_init_options_internal(false);
211 if (context_factory_name == "thread" && config::get_value<std::string>("smpi/privatization") != "no") {
212 XBT_WARN("mmap broken on FreeBSD, but dlopen+thread broken too. Switching to dlopen+raw contexts.");
213 context_factory_name = "raw";
217 /* use the factory specified by --cfg=contexts/factory:value */
218 for (auto const& [factory_name, factory] : context_factories)
219 if (context_factory_name == factory_name) {
220 instance_->set_context_factory(factory());
224 if (not instance_->has_context_factory()) {
225 XBT_ERROR("Invalid context factory specified. Valid factories on this machine:");
226 #if HAVE_RAW_CONTEXTS
227 XBT_ERROR(" raw: high performance context factory implemented specifically for SimGrid");
229 XBT_ERROR(" (raw contexts were disabled at compilation time on this machine -- check configure logs for details)");
231 #if HAVE_UCONTEXT_CONTEXTS
232 XBT_ERROR(" ucontext: classical system V contexts (implemented with makecontext, swapcontext and friends)");
234 XBT_ERROR(" (ucontext was disabled at compilation time on this machine -- check configure logs for details)");
236 #if HAVE_BOOST_CONTEXTS
237 XBT_ERROR(" boost: this uses the boost libraries context implementation");
239 XBT_ERROR(" (boost was disabled at compilation time on this machine -- check configure logs for details. Did you "
240 "install the libboost-context-dev package?)");
242 XBT_ERROR(" thread: slow portability layer using standard threads as provided by libstdc");
243 xbt_die("Please use a valid factory.");
247 void EngineImpl::shutdown()
249 if (EngineImpl::instance_ == nullptr)
251 XBT_DEBUG("EngineImpl::shutdown() called. Simulation's over.");
253 if (not instance_->actor_list_.empty()) {
254 if (smpi_process() && smpi_process()->initialized()) {
255 xbt_die("Process exited without calling MPI_Finalize - Killing simulation");
257 XBT_WARN("Process called exit when leaving - Skipping cleanups");
263 if (instance_->has_actors_to_run() && simgrid_get_clock() <= 0.0) {
265 XBT_CRITICAL("The time is still 0, and you still have processes ready to run.");
266 XBT_CRITICAL("It seems that you forgot to run the simulation that you setup.");
267 xbt_die("Bailing out to avoid that stop-before-start madness. Please fix your code.");
270 while (not timer::kernel_timers().empty()) {
271 delete timer::kernel_timers().top().second;
272 timer::kernel_timers().pop();
276 sg_platf_parser_finalize();
282 void EngineImpl::seal_platform() const
285 static bool sealed = false;
290 /* seal netzone root, recursively seal children netzones, hosts and disks */
291 netzone_root_->seal();
294 void EngineImpl::load_platform(const std::string& platf)
296 double start = xbt_os_time();
297 if (boost::algorithm::ends_with(platf, ".so") || boost::algorithm::ends_with(platf, ".dylib")) {
298 void* handle = dlopen(platf.c_str(), RTLD_LAZY);
299 xbt_assert(handle, "Impossible to open platform file: %s", platf.c_str());
300 platf_handle_ = std::unique_ptr<void, std::function<int(void*)>>(handle, dlclose);
301 using load_fct_t = void (*)(const simgrid::s4u::Engine&);
302 auto callable = (load_fct_t)dlsym(platf_handle_.get(), "load_platform");
303 const char* dlsym_error = dlerror();
304 xbt_assert(not dlsym_error, "Error: %s", dlsym_error);
305 callable(*simgrid::s4u::Engine::get_instance());
307 parse_platform_file(platf);
310 double end = xbt_os_time();
311 XBT_DEBUG("PARSE TIME: %g", (end - start));
314 void EngineImpl::load_deployment(const std::string& file) const
316 sg_platf_parser_finalize();
318 simgrid_parse_open(file);
320 simgrid_parse_close();
323 void EngineImpl::register_function(const std::string& name, const actor::ActorCodeFactory& code)
325 registered_functions[name] = code;
327 void EngineImpl::register_default(const actor::ActorCodeFactory& code)
329 default_function = code;
332 void EngineImpl::add_model(std::shared_ptr<resource::Model> model, const std::vector<resource::Model*>& dependencies)
334 auto model_name = model->get_name();
335 xbt_assert(models_prio_.find(model_name) == models_prio_.end(),
336 "Model %s already exists, use model.set_name() to change its name", model_name.c_str());
338 for (const auto* dep : dependencies) {
339 xbt_assert(models_prio_.find(dep->get_name()) != models_prio_.end(),
340 "Model %s doesn't exists. Impossible to use it as dependency.", dep->get_name().c_str());
342 models_.push_back(model.get());
343 models_prio_[model_name] = std::move(model);
346 /** Wake up all actors waiting for a Surf action to finish */
347 void EngineImpl::handle_ended_actions() const
349 for (auto const& model : models_) {
350 XBT_DEBUG("Handling the failed actions (if any)");
351 while (auto* action = model->extract_failed_action()) {
352 XBT_DEBUG(" Handling Action %p", action);
353 if (action->get_activity() != nullptr) { // Skip vcpu actions
354 // Action failures are not automatically reported when the action is started by maestro (as in SimDAG)
355 if (action->get_activity()->get_actor() == maestro_)
356 action->get_activity()->get_iface()->complete(s4u::Activity::State::FAILED);
358 activity::ActivityImplPtr(action->get_activity())->post();
361 XBT_DEBUG("Handling the terminated actions (if any)");
362 while (auto* action = model->extract_done_action()) {
363 XBT_DEBUG(" Handling Action %p", action);
364 if (action->get_activity() != nullptr) {
365 // Action termination are not automatically reported when the action is started by maestro (as in SimDAG)
366 action->get_activity()->set_finish_time(action->get_finish_time());
368 if (action->get_activity()->get_actor() == maestro_)
369 action->get_activity()->get_iface()->complete(s4u::Activity::State::FINISHED);
371 activity::ActivityImplPtr(action->get_activity())->post();
377 * @brief Executes the actors in actors_to_run.
379 * The actors in actors_to_run are run (in parallel if possible). On exit, actors_to_run is empty, and actors_that_ran
380 * contains the list of actors that just ran. The two lists are swapped so, be careful when using them before and after
381 * a call to this function.
383 void EngineImpl::run_all_actors()
385 instance_->get_context_factory()->run_all(actors_to_run_);
387 for (auto const& actor : actors_to_run_)
388 if (actor->to_be_freed())
389 actor->cleanup_from_kernel();
391 actors_to_run_.swap(actors_that_ran_);
392 actors_to_run_.clear();
395 actor::ActorImpl* EngineImpl::get_actor_by_pid(aid_t pid)
397 auto item = actor_list_.find(pid);
398 return item == actor_list_.end() ? nullptr : item->second;
401 void EngineImpl::remove_daemon(actor::ActorImpl* actor)
403 auto it = daemons_.find(actor);
404 xbt_assert(it != daemons_.end(), "The dying daemon is not a daemon after all. Please report that bug.");
408 void EngineImpl::add_actor_to_run_list_no_check(actor::ActorImpl* actor)
410 XBT_DEBUG("Inserting [%p] %s(%s) in the to_run list", actor, actor->get_cname(), actor->get_host()->get_cname());
411 actors_to_run_.push_back(actor);
414 void EngineImpl::add_actor_to_run_list(actor::ActorImpl* actor)
416 if (std::find(begin(actors_to_run_), end(actors_to_run_), actor) != end(actors_to_run_)) {
417 XBT_DEBUG("Actor %s is already in the to_run list", actor->get_cname());
419 XBT_DEBUG("Inserting [%p] %s(%s) in the to_run list", actor, actor->get_cname(), actor->get_host()->get_cname());
420 actors_to_run_.push_back(actor);
423 void EngineImpl::empty_trash()
425 while (not actors_to_destroy_.empty()) {
426 actor::ActorImpl* actor = &actors_to_destroy_.front();
427 actors_to_destroy_.pop_front();
428 XBT_DEBUG("Getting rid of %s (refcount: %d)", actor->get_cname(), actor->get_refcount());
429 intrusive_ptr_release(actor);
433 void EngineImpl::display_all_actor_status() const
435 XBT_INFO("%zu actors are still running, waiting for something.", actor_list_.size());
436 /* List the actors and their state */
437 XBT_INFO("Legend of the following listing: \"Actor <pid> (<name>@<host>): <status>\"");
438 for (auto const& [_, actor] : actor_list_) {
439 if (actor->waiting_synchro_) {
440 const char* synchro_description = "unknown";
442 if (boost::dynamic_pointer_cast<kernel::activity::ExecImpl>(actor->waiting_synchro_) != nullptr)
443 synchro_description = "execution";
445 if (boost::dynamic_pointer_cast<kernel::activity::CommImpl>(actor->waiting_synchro_) != nullptr)
446 synchro_description = "communication";
448 if (boost::dynamic_pointer_cast<kernel::activity::SleepImpl>(actor->waiting_synchro_) != nullptr)
449 synchro_description = "sleeping";
451 if (boost::dynamic_pointer_cast<kernel::activity::SynchroImpl>(actor->waiting_synchro_) != nullptr)
452 synchro_description = "synchronization";
454 if (boost::dynamic_pointer_cast<kernel::activity::IoImpl>(actor->waiting_synchro_) != nullptr)
455 synchro_description = "I/O";
457 XBT_INFO("Actor %ld (%s@%s): waiting for %s activity %#zx (%s) in state %s to finish %s", actor->get_pid(),
458 actor->get_cname(), actor->get_host()->get_cname(), synchro_description,
459 (xbt_log_no_loc ? (size_t)0xDEADBEEF : (size_t)actor->waiting_synchro_.get()),
460 actor->waiting_synchro_->get_cname(), actor->waiting_synchro_->get_state_str(),
461 (actor->simcall_.observer_ != nullptr && not xbt_log_no_loc
462 ? actor->simcall_.observer_->to_string().c_str()
465 XBT_INFO("Actor %ld (%s@%s) simcall %s", actor->get_pid(), actor->get_cname(), actor->get_host()->get_cname(),
466 (actor->simcall_.observer_ != nullptr ? actor->simcall_.observer_->to_string().c_str()
467 : actor->simcall_.get_cname()));
472 void EngineImpl::presolve() const
474 XBT_DEBUG("Consume all trace events occurring before the starting time.");
475 double next_event_date;
476 while ((next_event_date = profile::future_evt_set.next_date()) != -1.0) {
477 if (next_event_date > now_)
481 resource::Resource* resource = nullptr;
482 while (auto* event = profile::future_evt_set.pop_leq(next_event_date, &value, &resource)) {
484 resource->apply_event(event, value);
488 XBT_DEBUG("Set every models in the right state by updating them to 0.");
489 for (auto const& model : models_)
490 model->update_actions_state(now_, 0.0);
493 double EngineImpl::solve(double max_date) const
495 double time_delta = -1.0; /* duration */
497 resource::Resource* resource = nullptr;
499 if (max_date != -1.0) {
500 xbt_assert(max_date >= now_, "You asked to simulate up to %f, but that's in the past already", max_date);
502 time_delta = max_date - now_;
505 XBT_DEBUG("Looking for next event in all models");
506 for (auto model : models_) {
507 if (not model->next_occurring_event_is_idempotent()) {
510 double next_event = model->next_occurring_event(now_);
511 if ((time_delta < 0.0 || next_event < time_delta) && next_event >= 0.0) {
512 time_delta = next_event;
516 XBT_DEBUG("Min for resources (remember that NS3 don't update that value): %f", time_delta);
518 XBT_DEBUG("Looking for next trace event");
520 while (true) { // Handle next occurring events until none remains
521 double next_event_date = profile::future_evt_set.next_date();
522 XBT_DEBUG("Next TRACE event: %f", next_event_date);
524 for (auto model : models_) {
525 /* Skip all idempotent models, they were already treated above
526 * NS3 is the one to handled here */
527 if (model->next_occurring_event_is_idempotent())
530 if (next_event_date != -1.0) {
531 time_delta = std::min(next_event_date - now_, time_delta);
533 time_delta = std::max(next_event_date - now_, time_delta); // Get the positive component
536 XBT_DEBUG("Run the NS3 network at most %fs", time_delta);
537 // run until min or next flow
538 double model_next_action_end = model->next_occurring_event(time_delta);
540 XBT_DEBUG("Min for network : %f", model_next_action_end);
541 if (model_next_action_end >= 0.0)
542 time_delta = model_next_action_end;
545 if (next_event_date < 0.0 || (next_event_date > now_ + time_delta)) {
546 // next event may have already occurred or will after the next resource change, then bail out
547 XBT_DEBUG("no next usable TRACE event. Stop searching for it");
551 XBT_DEBUG("Updating models (min = %g, NOW = %g, next_event_date = %g)", time_delta, now_, next_event_date);
553 while (auto* event = profile::future_evt_set.pop_leq(next_event_date, &value, &resource)) {
556 if (resource->is_used() || (watched_hosts().find(resource->get_cname()) != watched_hosts().end())) {
557 time_delta = next_event_date - now_;
558 XBT_DEBUG("This event invalidates the next_occurring_event() computation of models. Next event set to %f",
561 // FIXME: I'm too lame to update now_ live, so I change it and restore it so that the real update works
562 double round_start = now_;
563 now_ = next_event_date;
564 /* update state of the corresponding resource to the new value. Does not touch lmm.
565 It will be modified if needed when updating actions */
566 XBT_DEBUG("Calling update_resource_state for resource %s", resource->get_cname());
567 resource->apply_event(event, value);
572 /* FIXME: Moved this test to here to avoid stopping simulation if there are actions running on cpus and all cpus are
573 * with availability = 0. This may cause an infinite loop if one cpu has a trace with periodicity = 0 and the other a
574 * trace with periodicity > 0.
575 * The options are: all traces with same periodicity(0 or >0) or we need to change the way how the events are managed
577 if (time_delta < 0) {
578 XBT_DEBUG("No next event at all. Bail out now.");
582 XBT_DEBUG("Duration set to %f", time_delta);
584 // Bump the time: jump into the future
587 // Inform the models of the date change
588 for (auto const& model : models_)
589 model->update_actions_state(now_, time_delta);
591 s4u::Engine::on_time_advance(time_delta);
596 void EngineImpl::run(double max_date)
600 if (MC_is_active()) {
602 mc::AppSide::get()->main_loop();
604 xbt_die("MC_is_active() is not supposed to return true in non-MC settings");
606 THROW_IMPOSSIBLE; // main_loop never returns
609 if (MC_record_replay_is_active()) {
610 mc::RecordTrace::replay(MC_record_path());
615 double elapsed_time = -1;
616 const std::set<s4u::Activity*>* vetoed_activities = s4u::Activity::get_vetoed_activities();
619 XBT_DEBUG("New Schedule Round; size(queue)=%zu", actors_to_run_.size());
621 if (cfg_breakpoint >= 0.0 && simgrid_get_clock() >= cfg_breakpoint) {
622 XBT_DEBUG("Breakpoint reached (%g)", cfg_breakpoint.get());
623 cfg_breakpoint = -1.0; // Let the simulation continue without hiting the breakpoint again and again
631 while (not actors_to_run_.empty()) {
632 XBT_DEBUG("New Sub-Schedule Round; size(queue)=%zu", actors_to_run_.size());
634 /* Run all actors that are ready to run, possibly in parallel */
637 /* answer sequentially and in a fixed arbitrary order all the simcalls that were issued during that sub-round.
638 * The order must be fixed for the simulation to be reproducible (see RR-7653). It's OK here because only maestro
639 * changes the list. Killer actors are moved to the end to let victims finish their simcall before dying, but
640 * the order remains reproducible (even if arbitrarily). No need to sort the vector for sake of reproducibility.
642 for (auto const& actor : actors_that_ran_)
643 if (actor->simcall_.call_ != actor::Simcall::Type::NONE)
644 actor->simcall_handle(0);
646 handle_ended_actions();
648 /* If only daemon actors remain, cancel their actions, mark them to die and reschedule them */
649 if (actor_list_.size() == daemons_.size())
650 for (auto const& dmon : daemons_) {
651 XBT_DEBUG("Kill %s", dmon->get_cname());
652 maestro_->kill(dmon);
656 // Compute the max_date of the next solve.
657 // It's either when a timer occurs, or when user-specified deadline is reached, or -1 if none is given
658 double next_time = timer::Timer::next();
659 if (next_time < 0 && max_date > -1) {
660 next_time = max_date;
661 } else if (next_time > -1 && max_date > -1) { // either both <0, or both >0
662 next_time = std::min(next_time, max_date);
665 XBT_DEBUG("Calling solve(%g) %g", next_time, now_);
666 elapsed_time = solve(next_time);
667 XBT_DEBUG("Moving time ahead. NOW=%g; elapsed: %g", now_, elapsed_time);
669 // Execute timers until there isn't anything to be done:
672 again = timer::Timer::execute_all();
673 handle_ended_actions();
676 /* Clean actors to destroy */
679 XBT_DEBUG("### elapsed time %f, #actors %zu, #to_run %zu, #vetoed %d", elapsed_time, actor_list_.size(),
680 actors_to_run_.size(), (vetoed_activities == nullptr ? -1 : static_cast<int>(vetoed_activities->size())));
682 if (elapsed_time < 0. && actors_to_run_.empty() && not actor_list_.empty()) {
683 if (actor_list_.size() <= daemons_.size()) {
684 XBT_CRITICAL("Oops! Daemon actors cannot do any blocking activity (communications, synchronization, etc) "
685 "once the simulation is over. Please fix your on_exit() functions.");
687 XBT_CRITICAL("Oops! Deadlock detected, some activities are still around but will never complete. "
688 "This usually happens when the user code is not perfectly clean.");
690 display_all_actor_status();
691 simgrid::s4u::Engine::on_deadlock();
692 for (auto const& [_, actor] : actor_list_) {
693 XBT_DEBUG("Kill %s", actor->get_cname());
694 maestro_->kill(actor);
697 } while ((vetoed_activities == nullptr || vetoed_activities->empty()) &&
698 ((elapsed_time > -1.0 && not double_equals(max_date, now_, 0.00001)) || has_actors_to_run()));
700 if (not actor_list_.empty() && max_date < 0 && not(vetoed_activities == nullptr || vetoed_activities->empty()))
703 simgrid::s4u::Engine::on_simulation_end();
706 double EngineImpl::get_clock()
710 } // namespace simgrid::kernel