From: Anthony Geay Date: Fri, 2 Aug 2024 06:59:02 +0000 (+0200) Subject: [EDF30662] : Avoid defunct process due to monitoring that can lead to #process limit... X-Git-Tag: emc2p_2.1.0-rc2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e6b1c6e48396728d90775c6234be595ea62ae9f9;p=modules%2Fkernel.git [EDF30662] : Avoid defunct process due to monitoring that can lead to #process limit in case of huge number of process --- diff --git a/src/Basics/Monitoring.cxx b/src/Basics/Monitoring.cxx index a04e2c564..6eac06de5 100644 --- a/src/Basics/Monitoring.cxx +++ b/src/Basics/Monitoring.cxx @@ -42,6 +42,8 @@ #include #include #include +#include +#include #endif #ifndef WIN32 @@ -113,7 +115,9 @@ std::vector SALOME::ReadFloatsInFile(const std::string& fileName) static void StopMonitoringLinux(long pid) { pid_t pid_of_subprocess = (pid_t) pid; - kill( pid_of_subprocess, SIGKILL ); + kill( pid_of_subprocess, SIGTERM ); + int wstatus; + waitpid( pid_of_subprocess, &wstatus , WUNTRACED); } #endif