cmake-server: Hang during running of child process in cmake 3.19.8
In our setup we run Gradle which uses cmake in server mode and in cmake we run another instance of cmake to configure and compile subproject for different architecture. I'm running it on MacOS x86_64 (seems that it's important because this is not reproducible in our Linux CIs). The call in CMakeLists.txt itself looks like:
execute_process(COMMAND ${CMAKE_COMMAND} --build . --target install
WORKING_DIRECTORY ${_tools_dir}
RESULT_VARIABLE _tools_result)
It hangs and I've built a debug version of cmake 3.19.8 to get symbols. Checking both parent and child processes I found that parent process hangs on
// ProcesUNIX.c: 1221
/* Run select to block until data are available. Repeat call
until it is not interrupted. */
while (((numReady = select(max + 1, &cp->PipeSet, 0, 0, timeout)) < 0) &&
(errno == EINTR)) {
}
and child process hangs on fflush
function inside std::cout here:
// cmakemain.cxx
if ((prog < 0) || (!dir.empty())) {
std::cout << "-- " << m << dir << cmakemainGetStack(cm) << std::endl;
}
I can't provide good example now (I'm attaching stack traces though) because it's not reproducible on small projects and when cmake is ran from terminal (instead of running from Gradle).
May be you have good ideas how to investigate this issue and what can be a reason?