Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorAdrien Lebre <alebre@dhcp-2-16.rech172-28.emn.fr>
Mon, 8 Dec 2014 17:14:47 +0000 (18:14 +0100)
committerAdrien Lebre <alebre@dhcp-2-16.rech172-28.emn.fr>
Mon, 8 Dec 2014 17:14:47 +0000 (18:14 +0100)
src/bindings/java/smx_context_java.c
src/msg/msg_vm.c

index 6a52403..29489d1 100644 (file)
@@ -12,6 +12,7 @@
 #include "smx_context_java.h"
 #include "jxbt_utilities.h"
 #include "xbt/dynar.h"
+#include "../../simix/smx_private.h"
 extern JavaVM *__java_vm;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jmsg, bindings, "MSG for Java(TM)");
@@ -153,12 +154,13 @@ void smx_ctx_java_stop(smx_context_t context)
   if (context->iwannadie) {
     context->iwannadie = 0;
     JNIEnv *env = get_current_thread_env();
-    XBT_DEBUG("Gonnal launch Killed Error");
+    XBT_DEBUG("Gonna launch Killed Error");
     // TODO Adrien, if the process has not been created at the java layer, why should we raise the exception/error at the java level (this happens
     // for instance during the migration process that creates at the C level two processes: one on the SRC node and one on the DST node, if the DST process is killed. 
     // it is not required to raise an exception at the JAVA level, the low level should be able to manage such an issue correctly but this is not the case right now unfortunately ...
     // TODO it will be nice to have the name of the process to help the end-user to know which Process has been killed
-    jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", bprintf("Process %s killed :) (file smx_context_java.c)", MSG_process_get_name( (msg_process_t)context) ));
+   // jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", bprintf("Process %s killed :) (file smx_context_java.c)", MSG_process_get_name( (msg_process_t)context) ));
+    jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", bprintf("Process %s killed :) (file smx_context_java.c)", simcall_process_get_name((smx_process_t) SIMIX_context_get_process(context))) );
     XBT_DEBUG("Trigger a cancel error at the C level");
     THROWF(cancel_error, 0, "process cancelled");
   } else {
index cf88b63..5665a84 100644 (file)
@@ -746,6 +746,7 @@ static int migration_tx_fun(int argc, char *argv[])
       /* At stage 1, we do not need timeout. We have to send all the memory
        * pages even though the duration of this tranfer exceeds the timeout
        * value. */
+      XBT_INFO("Stage 1: Gonna send %zd", ramsize);
       sg_size_t sent = send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, ramsize, ms->mbox, 1, 0, mig_speed, -1);
       remaining_size -= sent;
       computed_during_stage1 = lookup_computed_flop_counts(ms->vm, 1, 0);
@@ -813,6 +814,7 @@ static int migration_tx_fun(int argc, char *argv[])
     sg_size_t sent = 0;
     double clock_prev_send = MSG_get_clock();
     TRY {
+      XBT_INFO("Stage 2, gonna send %d", updated_size);
       sent = send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, updated_size, ms->mbox, 2, stage2_round, mig_speed, mig_timeout);
     } CATCH_ANONYMOUS {
       //hostfailure (if you want to know whether this is the SRC or the DST please check directly in send_migration_data code)
@@ -856,6 +858,7 @@ stage3:
   stop_dirty_page_tracking(ms->vm);
 
   TRY {
+    XBT_INFO("Stage 3: Gonna send %d", remaining_size);
     send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, remaining_size, ms->mbox, 3, 0, mig_speed, -1);
   } CATCH_ANONYMOUS {
     //hostfailure (if you want to know whether this is the SRC or the DST please check directly in send_migration_data code)
@@ -865,8 +868,7 @@ stage3:
   }
 
   // At that point the Migration is considered valid for the SRC node but remind that the DST side should relocate effectively the VM on the DST node.
-
-  XBT_DEBUG("mig: tx_done");
+  XBT_INFO("mig: tx_done");
 
   return 0;
 }
@@ -886,6 +888,7 @@ static int do_migration(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm)
   char *pr_rx_name = get_mig_process_rx_name(vm, src_pm, dst_pm);
   char *pr_tx_name = get_mig_process_tx_name(vm, src_pm, dst_pm);
 
+  msg_process_t tx_process, rx_process; 
 //  MSG_process_create(pr_rx_name, migration_rx_fun, ms, dst_pm);
 //  MSG_process_create(pr_tx_name, migration_tx_fun, ms, src_pm);
 #if 1
@@ -893,13 +896,13 @@ static int do_migration(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm)
  char **argv = xbt_new(char *, 2);
  argv[0] = pr_rx_name;
  argv[1] = NULL;
- MSG_process_create_with_arguments(pr_rx_name, migration_rx_fun, ms, dst_pm, 1, argv);
rx_process = MSG_process_create_with_arguments(pr_rx_name, migration_rx_fun, ms, dst_pm, 1, argv);
  }
  {
  char **argv = xbt_new(char *, 2);
  argv[0] = pr_tx_name;
  argv[1] = NULL;
- MSG_process_create_with_arguments(pr_tx_name, migration_tx_fun, ms, src_pm, 1, argv);
tx_process = MSG_process_create_with_arguments(pr_tx_name, migration_tx_fun, ms, src_pm, 1, argv);
  }
 #endif
 
@@ -909,7 +912,7 @@ static int do_migration(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm)
     msg_task_t task = NULL;
     msg_error_t ret = MSG_TIMEOUT;
     while (ret == MSG_TIMEOUT && MSG_host_is_on(dst_pm)) //Wait while you receive the message o
-     ret = MSG_task_receive_with_timeout(&task, ms->mbox_ctl, 10);
+     ret = MSG_task_receive_with_timeout(&task, ms->mbox_ctl, 3);
 
     xbt_free(ms->mbox_ctl);
     xbt_free(ms->mbox);
@@ -919,12 +922,13 @@ static int do_migration(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm)
     if(ret == MSG_HOST_FAILURE){
         // Note that since the communication failed, the owner did not change and the task should be destroyed on the other side.
         // Hence, just throw the execption
-        //XBT_INFO("SRC crashes, throw an exception (m-control)");
-        return -1;
-    }
+        XBT_INFO("SRC crashes, throw an exception (m-control)");
+        //MSG_process_kill(tx_process); // Adrien, I made a merge on Nov 28th 2014, I'm not sure whether this line is required or not 
+        return -1; 
+    } 
     else if((ret == MSG_TRANSFER_FAILURE) || (ret == MSG_TIMEOUT)){ // MSG_TIMEOUT here means that MSG_host_is_avail() returned false.
-        //XBT_INFO("DST crashes, throw an exception (m-control)");
-        return -2; 
+        XBT_INFO("DST crashes, throw an exception (m-control)");
+        return -2;  
     }