[Libreoffice-commits] online.git: common/IoUtil.cpp wsd/LOOLWSD.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Jan 16 02:10:00 UTC 2017
common/IoUtil.cpp | 4 +++-
wsd/LOOLWSD.cpp | 12 +++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
New commits:
commit 373b4646451200d7565d23793e276540adecf3f9
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Jan 15 12:32:20 2017 -0500
wsd: logs and cosmetics
Change-Id: I67b0a929a50b05cd44de056ce6f8baafb8574dbf
Reviewed-on: https://gerrit.libreoffice.org/33130
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/common/IoUtil.cpp b/common/IoUtil.cpp
index 3466dca..3991fc3 100644
--- a/common/IoUtil.cpp
+++ b/common/IoUtil.cpp
@@ -206,14 +206,16 @@ void SocketProcessor(const std::shared_ptr<LOOLWebSocket>& ws,
ssize_t writeToPipe(int pipe, const char* buffer, ssize_t size)
{
ssize_t count = 0;
- while(true)
+ for (;;)
{
LOG_TRC("Writing to pipe. Data: [" << Util::formatLinesForLog(std::string(buffer, size)) << "].");
const auto bytes = write(pipe, buffer + count, size - count);
if (bytes < 0)
{
if (errno == EINTR || errno == EAGAIN)
+ {
continue;
+ }
LOG_SYS("Failed to write to pipe. Data: [" << std::string(buffer, size) << "].");
count = -1;
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 7d0bb9f..e7d4ee7 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -399,13 +399,16 @@ static void preForkChildren()
UnitWSD::get().preSpawnCount(numPreSpawn);
// Wait until we have at least one child.
- const auto timeout = std::chrono::milliseconds(CHILD_TIMEOUT_MS * 3);
+ const auto timeoutMs = CHILD_TIMEOUT_MS * 3;
+ const auto timeout = std::chrono::milliseconds(timeoutMs);
+ LOG_TRC("Waiting for a new child for a max of " << timeoutMs << " ms.");
NewChildrenCV.wait_for(lock, timeout, []() { return !NewChildren.empty(); });
// Now spawn more, as needed.
rebalanceChildren(numPreSpawn);
// Make sure we have at least one before moving forward.
+ LOG_TRC("Waiting for a new child for a max of " << timeoutMs << " ms.");
if (!NewChildrenCV.wait_for(lock, timeout, []() { return !NewChildren.empty(); }))
{
const auto msg = "Failed to fork child processes.";
@@ -469,6 +472,7 @@ static std::shared_ptr<ChildProcess> getNewChild()
++numPreSpawn; // Replace the one we'll dispatch just now.
rebalanceChildren(numPreSpawn);
+ LOG_TRC("Waiting for a new child for a max of " << CHILD_TIMEOUT_MS << " ms.");
const auto timeout = chrono::milliseconds(CHILD_TIMEOUT_MS);
if (NewChildrenCV.wait_for(lock, timeout, []() { return !NewChildren.empty(); }))
{
@@ -1021,7 +1025,7 @@ private:
if (!child)
{
// Let the client know we can't serve now.
- LOG_ERR("Failed to get new child. Service Unavailable.");
+ LOG_ERR("Failed to get new child.");
return nullptr;
}
@@ -1104,6 +1108,9 @@ private:
{
LOG_CHECK_RET(docBroker && "Null docBroker instance", );
+ const auto docKey = docBroker->getDocKey();
+ LOG_DBG("Removing docBroker [" << docKey << "]" << (id.empty() ? "" : (" and session [" + id + "].")));
+
std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex);
auto lock = docBroker->getLock();
@@ -1114,7 +1121,6 @@ private:
if (docBroker->getSessionsCount() == 0 || !docBroker->isAlive())
{
- const auto docKey = docBroker->getDocKey();
LOG_INF("Removing unloaded DocumentBroker for docKey [" << docKey << "].");
DocBrokers.erase(docKey);
docBroker->terminateChild(lock);
More information about the Libreoffice-commits
mailing list