diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp index 4ef825403..c8edb7abf 100644 --- a/kit/ForKit.cpp +++ b/kit/ForKit.cpp @@ -278,6 +278,9 @@ static void cleanupChildren() int status = 0; int segFaultCount = 0; + LOG_TRC("cleanupChildren with " << childJails.size() + << (childJails.size() == 1 ? " child" : " children")); + // Reap quickly without doing slow cleanup so WSD can spawn more rapidly. while ((exitedChildPid = waitpid(-1, &status, WUNTRACED | WNOHANG)) > 0) { @@ -304,6 +307,16 @@ static void cleanupChildren() } } + if (Log::traceEnabled()) + { + std::ostringstream oss; + for (const auto& pair : childJails) + oss << pair.first << ' '; + + LOG_TRC("cleanupChildren reaped " << cleanupJailPaths.size() << " children to have " + << childJails.size() << " left: " << oss.str()); + } + if (segFaultCount) { #ifdef KIT_IN_PROCESS @@ -414,6 +427,8 @@ void forkLibreOfficeKit(const std::string& childRoot, const std::string& loSubPath, int limit) { + LOG_TRC("forkLibreOfficeKit limit: " << limit); + // Cleanup first, to reduce disk load. cleanupChildren(); diff --git a/wsd/COOLWSD.cpp b/wsd/COOLWSD.cpp index a9e33cd1f..51a89e230 100644 --- a/wsd/COOLWSD.cpp +++ b/wsd/COOLWSD.cpp @@ -4923,7 +4923,8 @@ std::set COOLWSD::getKitPids() for (const auto &child : NewChildren) { pid = child->getPid(); - pids.emplace(pid); + if (pid > 0) + pids.emplace(pid); } } {