/* 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 =
while (1) {
res = MSG_task_receive(&(task), mailbox);
+ if (res == MSG_HOST_FAILURE) {
+ XBT_DEBUG("The host has been turned off, this was expected");
+ return 1;
+ }
xbt_assert(res == MSG_OK, "MSG_task_get failed");
if (!strcmp(MSG_task_get_name(task), "finalize")) {
msg_task_t task = MSG_task_create("daemon", MSG_host_get_speed(MSG_host_self()), 0, NULL);
MSG_process_set_data(self, task);
XBT_INFO(" Execute daemon");
- MSG_task_execute(task);
- MSG_process_set_data(self, NULL);
+ msg_error_t res = MSG_task_execute(task);
MSG_task_destroy(task);
tasks_done++;
+ if (res == MSG_HOST_FAILURE) {
+ XBT_INFO("Host as died as expected, do nothing else");
+ return 0;
+ }
}
XBT_INFO(" daemon done. See you!");
return 0;
MSG_create_environment(argv[1]);
- MSG_process_set_data_cleanup(task_cleanup_handler);
MSG_process_create("test_launcher", test_launcher, NULL, MSG_get_host_by_name("Tremblay"));
res = MSG_main();
> [Tremblay:test_launcher:(1) 20.000000] [msg_test/INFO] Turn Jupiter off
> [Tremblay:test_launcher:(1) 20.000000] [msg_test/INFO] Test 5 seems ok (number of Process: 2, it should be 2)
> [Tremblay:test_launcher:(1) 20.000000] [msg_test/INFO] Test done. See you!
+> [Jupiter:commRX:(2) 20.000000] [msg_test/INFO] Receive message: HOST_FAILURE
+> [Jupiter:commRX:(2) 20.000000] [msg_test/INFO] RX Done
> [Tremblay:commTX:(3) 40.000000] [msg_test/INFO] TX done
> [40.000000] [msg_test/INFO] Simulation time 40
> [Jupiter:process_daemonJUPI:(3) 9.000011] [msg_test/INFO] Execute daemon
> [Tremblay:test_launcher:(1) 10.000000] [msg_test/INFO] Turn Jupiter off
> [Tremblay:test_launcher:(1) 10.000000] [msg_test/INFO] Shutdown vm0
+> [Jupiter:process_daemonJUPI:(3) 10.000000] [msg_test/INFO] Host as died as expected, do nothing else
> [Tremblay:test_launcher:(1) 10.000000] [msg_test/INFO] Destroy vm0
> [Tremblay:test_launcher:(1) 10.000000] [msg_test/INFO] Test 6 is also weird: when the node Jupiter is turned off once again, the VM and its daemon are not killed. However, the issue regarding the shutdown of hosted VMs can be seen a feature not a bug ;)
> [Tremblay:test_launcher:(1) 10.000000] [msg_test/INFO] Test done. See you!
msg_task_t task = NULL;
msg_error_t error = MSG_task_receive(&(task), mailbox);
if (error) {
- XBT_ERROR("Error while receiving message");
+ if (error != MSG_HOST_FAILURE)
+ XBT_ERROR("Error while receiving message");
+ else
+ XBT_DEBUG("The host has been turned off, this was expected");
return 1;
}