From: Frederic Suter Date: Wed, 27 Feb 2019 08:31:17 +0000 (+0100) Subject: make MSG_process_create die if host is off. X-Git-Tag: v3_22~232 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f2572574976b4fee3c4dc79ea83c34ddcd5917d0 make MSG_process_create die if host is off. This was requested by adsein long time ago. --- diff --git a/ChangeLog b/ChangeLog index 87eab8d815..9f4001bec8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,8 @@ MSG: This C++ function was a pimple in the C API, made necessary at some point by the Java bindings. This is fixed now. - Hide the examples into examples/deprecated. New users should use S4U. + - MSG_process_create and MSG_process_attach now crash if the host used + to run this process is off. XBT: - Drop sg_cmdline. Please use xbt_cmdline instead. diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index 0604ec941a..7a261de633 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -90,7 +90,7 @@ msg_process_t MSG_process_create_with_environment(const char *name, xbt_main_fun .get(); }); } catch (simgrid::HostFailureException const&) { - XBT_DEBUG("The warning has already been issued. Do nothing more than catching the exception."); + xbt_die("Could not create a new process on failed host %s.", host->get_cname()); } for (int i = 0; i != argc; ++i) diff --git a/teshsuite/msg/host_on_off_processes/host_on_off_processes.cpp b/teshsuite/msg/host_on_off_processes/host_on_off_processes.cpp index eb6b46359e..85eab76b4f 100644 --- a/teshsuite/msg/host_on_off_processes/host_on_off_processes.cpp +++ b/teshsuite/msg/host_on_off_processes/host_on_off_processes.cpp @@ -97,7 +97,7 @@ static int test_launcher(int /*argc*/, char** /*argv*/) } test = 2; - // Create a process that on a host that is turned off (this should not be possible) + // Create a process that on a host that is turned off (this is not allowed) if (xbt_dynar_search_or_negative(tests, &test) != -1) { XBT_INFO("Test 2:"); XBT_INFO(" Turn off Jupiter"); @@ -108,17 +108,7 @@ static int test_launcher(int /*argc*/, char** /*argv*/) argvF[0] = xbt_strdup("process_daemon"); MSG_process_create_with_arguments("process_daemon", process_daemon, NULL, jupiter, 1, argvF); MSG_process_sleep(10); - XBT_INFO(" Test 2 does not crash as it should (number of Process : %d, it should be 1)", MSG_process_get_number()); - XBT_INFO(" Ok so let's turn on/off the node to see whether the process is correctly bound to Jupiter"); - MSG_host_on(jupiter); - XBT_INFO(" Turn off"); - MSG_host_off(jupiter); - XBT_INFO(" sleep"); - MSG_process_sleep(10); - XBT_INFO("number of Process : %d it should be 1. The daemon that has been created for test2 has been correctly " - "destroyed....ok at least it looks rigorous, cool ! You just have to disallow the possibility to create " - "a new process on a node when the node is off.)", - MSG_process_get_number()); + XBT_INFO(" Test 2 does crash as it should. This message will not be displayed."); } test = 3; diff --git a/teshsuite/msg/host_on_off_processes/host_on_off_processes.tesh b/teshsuite/msg/host_on_off_processes/host_on_off_processes.tesh index e4dfcfbbe2..261b76ad6c 100644 --- a/teshsuite/msg/host_on_off_processes/host_on_off_processes.tesh +++ b/teshsuite/msg/host_on_off_processes/host_on_off_processes.tesh @@ -12,17 +12,12 @@ $ ${bindir}/host_on_off_processes ${platfdir}/small_platform.xml 1 --log=no_loc > [Tremblay:test_launcher:(1) 13.000000] [msg_test/INFO] Test done. See you! > [13.000000] [msg_test/INFO] Simulation time 13 +! expect signal SIGIOT $ ${bindir}/host_on_off_processes ${platfdir}/small_platform.xml 2 --log=no_loc > [Tremblay:test_launcher:(1) 0.000000] [msg_test/INFO] Test 2: > [Tremblay:test_launcher:(1) 0.000000] [msg_test/INFO] Turn off Jupiter > [0.000000] [simix_process/WARNING] Cannot launch actor 'process_daemon' on failed host 'Jupiter' -> [Tremblay:test_launcher:(1) 10.000000] [msg_test/INFO] Test 2 does not crash as it should (number of Process : 1, it should be 1) -> [Tremblay:test_launcher:(1) 10.000000] [msg_test/INFO] Ok so let's turn on/off the node to see whether the process is correctly bound to Jupiter -> [Tremblay:test_launcher:(1) 10.000000] [msg_test/INFO] Turn off -> [Tremblay:test_launcher:(1) 10.000000] [msg_test/INFO] sleep -> [Tremblay:test_launcher:(1) 20.000000] [msg_test/INFO] number of Process : 1 it should be 1. The daemon that has been created for test2 has been correctly destroyed....ok at least it looks rigorous, cool ! You just have to disallow the possibility to create a new process on a node when the node is off.) -> [Tremblay:test_launcher:(1) 20.000000] [msg_test/INFO] Test done. See you! -> [20.000000] [msg_test/INFO] Simulation time 20 +> [Tremblay:test_launcher:(1) 0.000000] [xbt/CRITICAL] Could not create a new process on failed host Jupiter. $ ${bindir}/host_on_off_processes ${platfdir}/small_platform.xml 4 --log=no_loc > [Tremblay:test_launcher:(1) 0.000000] [msg_test/INFO] Test 4 (turn off src during a communication) : Create a Process/task to make a communication between Jupiter and Tremblay and turn off Jupiter during the communication