wsd/LOOLWSD.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
New commits: commit fb1e8eb63ae6a0b8626e6e798fa45176e4f6e713 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Sun Jan 1 15:42:22 2017 -0500 wsd: flag for shutdown when we fail to create forkit And say 'forkit' in the logs where we recognize it instead of the generic 'child'. Change-Id: I7628b064bb6330db145a948640e48b727def3270 Reviewed-on: https://gerrit.libreoffice.org/32619 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index f30edf0..f46df92 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -464,7 +464,7 @@ static std::shared_ptr<ChildProcess> getNewChild() } } - LOG_DBG("getNewChild: No live child, forking more."); + LOG_WRN("getNewChild: No available child. Sending spawn request to forkit and failing."); } while (chrono::duration_cast<chrono::milliseconds>(chrono::steady_clock::now() - startTime).count() < CHILD_TIMEOUT_MS * 4); @@ -2102,12 +2102,12 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/) { if (WIFEXITED(status)) { - LOG_INF("Child process [" << pid << "] exited with code: " << + LOG_INF("Forkit process [" << pid << "] exited with code: " << WEXITSTATUS(status) << "."); } else { - LOG_ERR("Child process [" << pid << "] " << + LOG_ERR("Forkit process [" << pid << "] " << (WCOREDUMP(status) ? "core-dumped" : "died") << " with " << SigUtil::signalName(WTERMSIG(status))); } @@ -2118,17 +2118,18 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/) if (forKitPid < 0) { LOG_FTL("Failed to spawn forkit instance. Shutting down."); + SigUtil::requestShutdown(); break; } } else if (WIFSTOPPED(status)) { - LOG_INF("Child process [" << pid << "] stopped with " << + LOG_INF("Forkit process [" << pid << "] stopped with " << SigUtil::signalName(WSTOPSIG(status))); } else if (WIFCONTINUED(status)) { - LOG_INF("Child process [" << pid << "] resumed with SIGCONT."); + LOG_INF("Forkit process [" << pid << "] resumed with SIGCONT."); } else { @@ -2137,17 +2138,24 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/) } else { - LOG_ERR("An unknown child process died, pid: " << pid); + LOG_ERR("An unknown child process [" << pid << "] died."); } } else if (pid < 0) { - LOG_SYS("waitpid failed."); + LOG_SYS("Forkit waitpid failed."); if (errno == ECHILD) { // No child processes. - LOG_FTL("No Forkit instance. Terminating."); - break; + // Spawn a new forkit and try to dust it off and resume. + close(ForKitWritePipe); + forKitPid = createForKit(); + if (forKitPid < 0) + { + LOG_FTL("Failed to spawn forkit instance. Shutting down."); + SigUtil::requestShutdown(); + break; + } } } else // pid == 0, no children have died _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits