From: Arnaud Legrand Date: Wed, 8 Apr 2015 13:06:44 +0000 (+0200) Subject: Making the exception/exception test work: X-Git-Tag: v3_12~732^2~61^2^2~6 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/068c7c9cf6ec9fe22cc80d65633a7c05caf767f5 Making the exception/exception test work: Always putting the process in the process_to_run list is bad. Indeed, when canceling tasks (e.g., with SIMIX_host_execution_cancel), the action will be cancelled and the corresponding process will be run again when the action is popped from the list. This leads to very surprising behavior since the action is only popped way after, generally after calling surf_solve.... This is why the fix has two parts: 1) Do not put in the process_to_run list when canceling the action 2) Once all process have been run, pop the surf actions in case some have been modified --- diff --git a/src/simix/smx_global.c b/src/simix/smx_global.c index 317ea1572c..43e7f830ea 100644 --- a/src/simix/smx_global.c +++ b/src/simix/smx_global.c @@ -404,6 +404,22 @@ void SIMIX_run(void) SIMIX_simcall_handle(&process->simcall, 0); } } + /* Wake up all processes waiting for a Surf action to finish */ + xbt_dynar_foreach(model_list, iter, model) { + XBT_DEBUG("Handling process whose action failed"); + while ((action = surf_model_extract_failed_action_set(model))) { + XBT_DEBUG(" Handling Action %p",action); + SIMIX_simcall_exit((smx_synchro_t) surf_action_get_data(action)); + } + XBT_DEBUG("Handling process whose action terminated normally"); + while ((action = surf_model_extract_done_action_set(model))) { + XBT_DEBUG(" Handling Action %p",action); + if (surf_action_get_data(action) == NULL) + XBT_DEBUG("probably vcpu's action %p, skip", action); + else + SIMIX_simcall_exit((smx_synchro_t) surf_action_get_data(action)); + } + } } time = SIMIX_timer_next(); diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index ce66e94440..b7389741f9 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -404,11 +404,12 @@ void SIMIX_process_throw(smx_process_t process, xbt_errcat_t cat, int value, con break; case SIMIX_SYNC_SLEEP: - SIMIX_process_sleep_destroy(process->waiting_synchro); - break; - case SIMIX_SYNC_JOIN: SIMIX_process_sleep_destroy(process->waiting_synchro); + if (!xbt_dynar_member(simix_global->process_to_run, &(process)) && process != SIMIX_process_self()) { + XBT_DEBUG("Inserting %s in the to_run list", process->name); + xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process); + } break; case SIMIX_SYNC_SYNCHRO: @@ -423,8 +424,6 @@ void SIMIX_process_throw(smx_process_t process, xbt_errcat_t cat, int value, con } process->waiting_synchro = NULL; - if (!xbt_dynar_member(simix_global->process_to_run, &(process)) && process != SIMIX_process_self()) - xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process); } void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid) {