From: mlaurent Date: Fri, 24 Mar 2023 09:16:12 +0000 (+0100) Subject: Merge branch 'master' of https://framagit.org/simgrid/simgrid X-Git-Tag: v3.34~240^2~9 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/30382b06d3320a281f1556546e3b0a8112bd055a?hp=50753d5f8442a47c17c4035724201a18a7ff6146 Merge branch 'master' of https://framagit.org/simgrid/simgrid --- diff --git a/src/mc/remote/AppSide.cpp b/src/mc/remote/AppSide.cpp index 7e6e4145f2..447f7db0f4 100644 --- a/src/mc/remote/AppSide.cpp +++ b/src/mc/remote/AppSide.cpp @@ -246,6 +246,10 @@ void AppSide::handle_messages() std::array message_buffer; ssize_t received_size = channel_.receive(message_buffer.data(), message_buffer.size()); + if (received_size == 0) { + XBT_DEBUG("Socket closed on the Checker side, bailing out."); + ::_Exit(0); // Nobody's listening to that process anymore => exit as quickly as possible. + } xbt_assert(received_size >= 0, "Could not receive commands from the model-checker"); xbt_assert(static_cast(received_size) >= sizeof(s_mc_message_t), "Cannot handle short message (size=%zd)", received_size); diff --git a/src/mc/remote/CheckerSide.cpp b/src/mc/remote/CheckerSide.cpp index 5958cd33ee..9cc1f7d833 100644 --- a/src/mc/remote/CheckerSide.cpp +++ b/src/mc/remote/CheckerSide.cpp @@ -220,11 +220,13 @@ CheckerSide::~CheckerSide() if (running()) { XBT_DEBUG("Killing process"); - finalize(true); kill(get_pid(), SIGKILL); - terminate(); - handle_waitpid(); + while (waitpid(-1, nullptr, WNOHANG) > 0) { + /* we don't really care about errors here, as we are shutting things down anyway */ + /* The child will get ripped by the next waitpid anyway */ + } } + // usleep(500); // Try to reduce the load on my system. Commented because it's not even enough :( } void CheckerSide::finalize(bool terminate_asap)