[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-0' - wsd/LOOLWSD.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Feb 27 09:20:45 UTC 2017
wsd/LOOLWSD.cpp | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
New commits:
commit adb43e7a9c7405e176b0bb8821799678a3be496f
Author: Ashod Nakashian <ashod.nakashian at 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 <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
(cherry picked from commit fb1e8eb63ae6a0b8626e6e798fa45176e4f6e713)
Reviewed-on: https://gerrit.libreoffice.org/34637
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index faa1ed8..a59d042 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -444,7 +444,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);
@@ -2072,12 +2072,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)));
}
@@ -2088,17 +2088,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) == true)
{
- LOG_INF("Child process [" << pid << "] stopped with " <<
+ LOG_INF("Forkit process [" << pid << "] stopped with " <<
SigUtil::signalName(WSTOPSIG(status)));
}
else if (WIFCONTINUED(status) == true)
{
- LOG_INF("Child process [" << pid << "] resumed with SIGCONT.");
+ LOG_INF("Forkit process [" << pid << "] resumed with SIGCONT.");
}
else
{
@@ -2107,17 +2108,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
More information about the Libreoffice-commits
mailing list