[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-7' - loolwsd/LOOLSession.cpp
Jan Holesovsky
kendy at collabora.com
Fri Jan 22 16:45:18 PST 2016
loolwsd/LOOLSession.cpp | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
New commits:
commit c9bb1efb34d04e834a023600c6970d86d0dac8b1
Author: Jan Holesovsky <kendy at collabora.com>
Date: Sat Jan 23 01:40:26 2016 +0100
loolwsd: Don't wait for the child infinitely.
Re-try, and then give up if we don't get an answer.
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 9da15b0..c25f4c3 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -696,8 +696,22 @@ void MasterProcessSession::dispatchChild()
if (_availableChildSessions.size() == 0)
{
std::cout << Util::logPrefix() << "waiting for a child session to become available" << std::endl;
- _availableChildSessionCV.wait(lock, [] { return _availableChildSessions.size() > 0; });
- std::cout << Util::logPrefix() << "waiting done" << std::endl;
+ if (_availableChildSessionCV.wait_for(lock, std::chrono::minutes(5), [] { return _availableChildSessions.size() > 0; }))
+ std::cout << Util::logPrefix() << "waiting done" << std::endl;
+ else
+ {
+ std::cout << Util::logPrefix() << "waiting for the child session timed out, last try to start a new session" << std::endl;
+ LOOLWSD::_namedMutexLOOL.lock();
+ ++reinterpret_cast<size_t*>(LOOLWSD::_sharedForkChild.begin())[0];
+ LOOLWSD::_namedMutexLOOL.unlock();
+
+ if (!_availableChildSessionCV.wait_for(lock, std::chrono::minutes(5), [] { return _availableChildSessions.size() > 0; }))
+ {
+ std::cout << Util::logPrefix() << "real trouble starting new session, giving up" << std::endl;
+ lock.unlock();
+ return;
+ }
+ }
}
childSession = *(_availableChildSessions.begin());
More information about the Libreoffice-commits
mailing list