test: close testCrashKit race.

LOOLWSD is conservative and leaves forkit to start processes for a
while. If we kill a kit before it has started and registered we can
end up with LOOLWSD holding off to wait for the (now dead) kit, and
the tearDown assertions that we have 1 kit failing.

Change-Id: Id25e48bf55d1757d2223816293500fde6ff9df1b
Reviewed-on: https://gerrit.libreoffice.org/71811
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
This commit is contained in:
Michael Meeks 2019-05-04 22:50:00 +01:00
parent 92603013de
commit 264450758a
2 changed files with 7 additions and 0 deletions

View file

@ -136,6 +136,9 @@ void HTTPCrashTest::testCrashKit()
{
std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("empty.odt", _uri, testname);
TST_LOG("Allowing time for kits to spawn and connect to wsd to get cleanly killed");
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
TST_LOG("Killing loolkit instances.");
killLoKitProcesses();

View file

@ -361,6 +361,7 @@ void cleanupDocBrokers()
/// -1 for error.
static int forkChildren(const int number)
{
LOG_TRC("Request forkit to spawn " << number << " new child(ren)");
Util::assertIsLocked(NewChildrenMutex);
if (number > 0)
@ -1490,6 +1491,9 @@ void LOOLWSD::autoSave(const std::string& docKey)
void PrisonerPoll::wakeupHook()
{
#if !MOBILEAPP
LOG_TRC("PrisonerPoll - wakes up with " << NewChildren.size() <<
" new children and " << DocBrokers.size() << " brokers and " <<
OutstandingForks << " kits forking");
if (!LOOLWSD::checkAndRestoreForKit())
{
// No children have died.