- mingw32-make.exe VERBOSE=1 java-all python-bindings # Only the Java and Python parts
- ctest --output-on-failure -R java
# Don't test python, as pybind11 seems too complex for mingw for now (mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1)
-# The observed failure is around the StopRequest exception, that seems badly catched somehow.
+# The observed failure is around the ForcefulKill exception, that seems badly catched somehow.
# - ctest --output-on-failure -R python
artifacts:
env->ExceptionClear();
XBT_ATTRIB_UNUSED jint error = __java_vm->DetachCurrentThread();
xbt_assert(error == JNI_OK, "Cannot detach failing thread");
- simgrid::kernel::context::StopRequest::do_throw();
+ simgrid::kernel::context::ForcefulKillException::do_throw();
}
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_off(JNIEnv *env, jobject jhost) {
msg_host_t host = jhost_get_native(env, jhost);
- if (not simgrid::kernel::context::StopRequest::try_n_catch([host]() { MSG_host_off(host); }))
+ if (not simgrid::kernel::context::ForcefulKillException::try_n_catch([host]() { MSG_host_off(host); }))
jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", "Host turned off");
}
{
double time = ((double)jmillis) / 1000 + ((double)jnanos) / 1000000000;
msg_error_t rv = MSG_OK;
- if (not simgrid::kernel::context::StopRequest::try_n_catch(
+ if (not simgrid::kernel::context::ForcefulKillException::try_n_catch(
[&time]() { simgrid::s4u::this_actor::sleep_for(time); })) {
rv = MSG_HOST_FAILURE;
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_waitFor(JNIEnv * env, jobject jprocess, jdouble jseconds)
{
msg_error_t rv = MSG_OK;
- if (not simgrid::kernel::context::StopRequest::try_n_catch(
+ if (not simgrid::kernel::context::ForcefulKillException::try_n_catch(
[&jseconds]() { simgrid::s4u::this_actor::sleep_for((double)jseconds); })) {
rv = MSG_HOST_FAILURE;
jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", "Process killed");
jxbt_throw_notbound(env, "process", jprocess);
return;
}
- if (not simgrid::kernel::context::StopRequest::try_n_catch([&process]() { MSG_process_kill(process); })) {
+ if (not simgrid::kernel::context::ForcefulKillException::try_n_catch([&process]() { MSG_process_kill(process); })) {
jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", "Process killed");
}
}
return;
}
msg_error_t rv;
- if (not simgrid::kernel::context::StopRequest::try_n_catch([&rv, &task]() { rv = MSG_task_execute(task); })) {
+ if (not simgrid::kernel::context::ForcefulKillException::try_n_catch(
+ [&rv, &task]() { rv = MSG_task_execute(task); })) {
jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", "Process killed");
}
const char *alias = env->GetStringUTFChars(jalias, 0);
msg_error_t rv;
- if (not simgrid::kernel::context::StopRequest::try_n_catch([&rv, &task, &alias, &jtimeout]() {
+ if (not simgrid::kernel::context::ForcefulKillException::try_n_catch([&rv, &task, &alias, &jtimeout]() {
rv = MSG_task_receive_ext(&task, alias, (double)jtimeout, /*host*/ nullptr);
})) {
jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", "Process killed");
{
msg_vm_t vm = jvm_get_native(env,jvm);
msg_host_t host = jhost_get_native(env, jhost);
- if (not simgrid::kernel::context::StopRequest::try_n_catch([&vm, &host]() { MSG_vm_migrate(vm, host); })) {
+ if (not simgrid::kernel::context::ForcefulKillException::try_n_catch([&vm, &host]() { MSG_vm_migrate(vm, host); })) {
XBT_VERB("Caught exception during migration");
jxbt_throw_host_failure(env, "during migration");
}
m.attr("simgrid_version") = simgrid_version;
// Internal exception used to kill actors and sweep the RAII chimney (free objects living on the stack)
- py::object pyStopRequestEx = py::register_exception<simgrid::kernel::context::StopRequest>(m, "ActorKilled");
+ py::object pyForcefulKillEx =
+ py::register_exception<simgrid::kernel::context::ForcefulKillException>(m, "ActorKilled");
/* this_actor namespace */
void (*sleep_for_fun)(double) = &simgrid::s4u::this_actor::sleep_for; // pick the right overload
":cpp:func:`simgrid::s4u::Engine::load_deployment()`")
.def("run", &Engine::run, "Run the simulation")
.def("register_actor",
- [pyStopRequestEx](Engine*, const std::string& name, py::object fun_or_class) {
+ [pyForcefulKillEx](Engine*, const std::string& name, py::object fun_or_class) {
simgrid::simix::register_function(
- name, [pyStopRequestEx, fun_or_class](std::vector<std::string> args) -> simgrid::simix::ActorCode {
- return [pyStopRequestEx, fun_or_class, args]() {
+ name, [pyForcefulKillEx, fun_or_class](std::vector<std::string> args) -> simgrid::simix::ActorCode {
+ return [pyForcefulKillEx, fun_or_class, args]() {
try {
/* Convert the std::vector into a py::tuple */
py::tuple params(args.size() - 1);
if (py::isinstance<py::function>(res))
res();
} catch (py::error_already_set& ex) {
- if (ex.matches(pyStopRequestEx)) {
+ if (ex.matches(pyForcefulKillEx)) {
XBT_VERB("Actor killed");
- /* Stop here that StopRequest exception which was meant to free the RAII stuff on the stack */
+ /* Stop here that ForcefulKill exception which was meant to free the RAII stuff on the stack */
} else {
throw;
}
"application, see :ref:`class s4u::Actor <API_s4u_Actor>`")
.def("create",
- [pyStopRequestEx](py::str name, py::object host, py::object fun, py::args args) {
+ [pyForcefulKillEx](py::str name, py::object host, py::object fun, py::args args) {
- return simgrid::s4u::Actor::create(name, host.cast<Host*>(), [fun, args, pyStopRequestEx]() {
+ return simgrid::s4u::Actor::create(name, host.cast<Host*>(), [fun, args, pyForcefulKillEx]() {
try {
fun(*args);
} catch (py::error_already_set& ex) {
- if (ex.matches(pyStopRequestEx)) {
+ if (ex.matches(pyForcefulKillEx)) {
XBT_VERB("Actor killed");
- /* Stop here that StopRequest exception which was meant to free the RAII stuff on the stack */
+ /* Stop here that ForcefulKill exception which was meant to free the RAII stuff on the stack */
} else {
throw;
}
AttachContext::~AttachContext() = default;
-StopRequest::~StopRequest() = default;
+ForcefulKillException::~ForcefulKillException() = default;
-void StopRequest::do_throw()
+void ForcefulKillException::do_throw()
{
- throw StopRequest();
+ throw ForcefulKillException();
}
-bool StopRequest::try_n_catch(std::function<void(void)> try_block)
+bool ForcefulKillException::try_n_catch(std::function<void(void)> try_block)
{
bool res;
try {
try_block();
res = true;
- } catch (StopRequest const&) {
- XBT_DEBUG("Caught a StopRequest");
+ } catch (ForcefulKillException const&) {
+ XBT_DEBUG("Caught a ForcefulKillException");
res = false;
}
return res;
virtual void attach_stop() = 0;
};
-class XBT_PUBLIC StopRequest {
- /** @brief Exception launched to kill an actor; do not block it!
+class XBT_PUBLIC ForcefulKillException {
+ /** @brief Exception launched to kill an actor; DO NOT BLOCK IT!
*
* This exception is thrown whenever the actor's host is turned off. The actor stack is properly unwinded to release
* all objects allocated on the stack (RAII powa).
*
* You may want to catch this exception to perform some extra cleanups in your simulation, but YOUR ACTORS MUST NEVER
- * SURVIVE a StopRequest, or your simulation will segfault.
+ * SURVIVE a ForcefulKillException, or your simulation will segfault.
*
* @verbatim
* void* payload = malloc(512);
*
* try {
* simgrid::s4u::this_actor::execute(100000);
- * } catch (simgrid::kernel::context::StopRequest& e) { // oops, my host just turned off
+ * } catch (simgrid::kernel::context::ForcefulKillException& e) { // oops, my host just turned off
* free(malloc);
* throw; // I shall never survive on an host that was switched off
* }
* Otherwise, users may accidentally catch it with a try {} catch (std::exception)
*/
public:
- StopRequest() = default;
- explicit StopRequest(const std::string& msg) : msg_(std::string("Actor killed (") + msg + std::string(").")) {}
- ~StopRequest();
+ ForcefulKillException() = default;
+ explicit ForcefulKillException(const std::string& msg) : msg_(std::string("Actor killed (") + msg + std::string(")."))
+ {
+ }
+ ~ForcefulKillException();
const char* what() const noexcept { return msg_.c_str(); }
static void do_throw();
try {
(*context)();
context->Context::stop();
- } catch (StopRequest const&) {
- XBT_DEBUG("Caught a StopRequest");
+ } catch (ForcefulKillException const&) {
+ XBT_DEBUG("Caught a ForcefulKillException");
} catch (simgrid::Exception const& e) {
XBT_INFO("Actor killed by an uncatched exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
throw;
try {
(*context)();
context->Context::stop();
- } catch (StopRequest const&) {
- XBT_DEBUG("Caught a StopRequest");
+ } catch (ForcefulKillException const&) {
+ XBT_DEBUG("Caught a ForcefulKillException");
} catch (simgrid::Exception const& e) {
XBT_INFO("Actor killed by an uncatched exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
throw;
{
Context::stop();
/* We must cut the actor execution using an exception to properly free the C++ RAII variables */
- throw StopRequest();
+ throw ForcefulKillException();
}
/** Maestro wants to run all ready actors */
context->Context::stop();
context->stop_hook();
}
- } catch (StopRequest const&) {
- XBT_DEBUG("Caught a StopRequest in Thread::wrapper");
- xbt_assert(not context->is_maestro(), "Maestro shall not receive StopRequests, even when detached.");
+ } catch (ForcefulKillException const&) {
+ XBT_DEBUG("Caught a ForcefulKillException in Thread::wrapper");
+ xbt_assert(not context->is_maestro(), "Maestro shall not receive ForcefulKillExceptions, even when detached.");
} catch (simgrid::Exception const& e) {
XBT_INFO("Actor killed by an uncatched exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
throw;
{
Context::stop();
stop_hook();
- throw StopRequest();
+ throw ForcefulKillException();
}
void ThreadContext::suspend()
try {
(*context)();
context->Context::stop();
- } catch (simgrid::kernel::context::StopRequest const&) {
- XBT_DEBUG("Caught a StopRequest");
+ } catch (simgrid::kernel::context::ForcefulKillException const&) {
+ XBT_DEBUG("Caught a ForcefulKillException");
} catch (simgrid::Exception const& e) {
XBT_INFO("Actor killed by an uncatched exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
throw;
// Forcefully kill the actor if its host is turned off. Not a HostFailureException because you should not survive that
if (not host_->is_on())
- this->throw_exception(std::make_exception_ptr(simgrid::kernel::context::StopRequest("host failed")));
+ this->throw_exception(std::make_exception_ptr(simgrid::kernel::context::ForcefulKillException("host failed")));
/* destroy the blocking synchro if any */
if (waiting_synchro != nullptr) {
if (context_->iwannadie) {
XBT_DEBUG("Actor %s@%s is dead", get_cname(), host_->get_cname());
- // throw simgrid::kernel::context::StopRequest(); Does not seem to properly kill the actor
+ // throw simgrid::kernel::context::ForcefulKillException(); Does not seem to properly kill the actor
context_->stop();
THROW_IMPOSSIBLE;
}
std::abort();
}
- catch (simgrid::kernel::context::StopRequest& e) {
- XBT_ERROR("Received a StopRequest at the top-level exception handler. Maybe a Java->C++ call that is not protected "
+ catch (simgrid::kernel::context::ForcefulKillException& e) {
+ XBT_ERROR("Received a ForcefulKillException at the top-level exception handler. Maybe a Java->C++ call that is not "
+ "protected "
"in a try/catch?");
show_backtrace(bt);
}