wsd/LOOLWSD.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
New commits: commit f3fb3beeea67009a745ab7752789ff6068ac54e7 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Sun Jan 15 12:58:32 2017 -0500 wsd: block new requests when recovering forkit Change-Id: Ibed650b52f2398cd336332b5264439752ff9e290 Reviewed-on: https://gerrit.libreoffice.org/33133 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 7d55971..f040bcd 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -393,10 +393,10 @@ static bool rebalanceChildren(int balance) } /// Called on startup only. -static void preForkChildren() +static void preForkChildren(std::unique_lock<std::mutex>& lock) { - std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex); - std::unique_lock<std::mutex> lock(NewChildrenMutex); + Util::assertIsLocked(DocBrokersMutex); + Util::assertIsLocked(lock); int numPreSpawn = LOOLWSD::NumPreSpawnedChildren; UnitWSD::get().preSpawnCount(numPreSpawn); @@ -2102,6 +2102,10 @@ Process::PID LOOLWSD::createForKit() args.push_back("--nocaps"); } + // If we're recovering forkit, don't allow processing new requests. + std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex); + std::unique_lock<std::mutex> newChildrenLock(NewChildrenMutex); + LOG_INF("Launching forkit process: " << forKitPath << ' ' << Poco::cat(std::string(" "), args.begin(), args.end())); @@ -2120,7 +2124,7 @@ Process::PID LOOLWSD::createForKit() Admin::instance().setForKitPid(forkitPid); // Spawn some children, if necessary. - preForkChildren(); + preForkChildren(newChildrenLock); return forkitPid; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits