loolwsd/LOOLWSD.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
New commits: commit 383eb5c666a143d90f2addc463d717da333e595f Author: Tor Lillqvist <t...@collabora.com> Date: Mon Apr 4 11:04:34 2016 +0300 Don't ask broker to fork a non-positive number of children I easily got the thing into a state where it kept forking new processes without limit even if no client was doing anything. The log output contained lines like: wsd-09526-04 00:00:48.302029 [client_ws_001b ] MasterToBroker: spawn -1 brk-09528-00 00:00:48.279945 [loolbroker ] Broker command: [spawn -1]. brk-09528-00 00:00:48.279964 [loolbroker ] Spawning -1 childs per request. brk-09528-00 00:00:48.279974 [loolbroker ] Creating -1 new child. This fixes that, but there are still several issues remaining. diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 1eb2955..1798d32 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -192,9 +192,12 @@ std::shared_ptr<ChildProcess> getNewChild() balance -= available - 1; } - const std::string aMessage = "spawn " + std::to_string(balance) + "\n"; - Log::debug("MasterToBroker: " + aMessage.substr(0, aMessage.length() - 1)); - IoUtil::writeFIFO(LOOLWSD::BrokerWritePipe, aMessage); + if (balance > 0) + { + const std::string aMessage = "spawn " + std::to_string(balance) + "\n"; + Log::debug("MasterToBroker: " + aMessage.substr(0, aMessage.length() - 1)); + IoUtil::writeFIFO(LOOLWSD::BrokerWritePipe, aMessage); + } if (available > 0) { commit 9a456770f1bd5c855bed1e5c237b7f61a0fc321c Author: Tor Lillqvist <t...@collabora.com> Date: Mon Apr 4 10:57:44 2016 +0300 Why 'signed' when 'int' is much simpler? diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 6f28356..1eb2955 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -181,8 +181,8 @@ std::shared_ptr<ChildProcess> getNewChild() { std::unique_lock<std::mutex> lock(newChildsMutex); - const signed available = newChilds.size(); - signed balance = LOOLWSD::NumPreSpawnedChildren; + const int available = newChilds.size(); + int balance = LOOLWSD::NumPreSpawnedChildren; if (available == 0) { Log::error("No available child. Sending spawn request to Broker and failing."); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits