From aa31d3d8cc4fae27d51d2d1a7270ed356c18ced8 Mon Sep 17 00:00:00 2001 From: David Kelly Date: Fri, 21 Oct 2016 14:43:39 -0700 Subject: [PATCH] Heartbeats need to happen while waiting for sandbox We can only know if sandbox is up by waiting for the http request to succeed or fail. In the common case (fail since it isn't up yet), we have to wait until a connect timeout in http. Seems that is a couple seconds, and in that time we really upset the deadlock watchdog thread since it keeps a moving average of heartbeat times. Simple solution, updateHeartbeat while waiting, and right before we start. --- interface/src/Application.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 5c47519529..9653fb29ce 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -585,6 +585,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo static bool determinedSandboxState = false; static bool sandboxIsRunning = false; SandboxUtils sandboxUtils; + // updateHeartbeat() because we are going to poll shortly... + updateHeartbeat(); sandboxUtils.ifLocalSandboxRunningElse([&]() { qCDebug(interfaceapp) << "Home sandbox appears to be running....."; determinedSandboxState = true; @@ -605,6 +607,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo auto startWaiting = usecTimestampNow(); while (!determinedSandboxState && (usecTimestampNow() - startWaiting <= MAX_WAIT_TIME)) { QCoreApplication::processEvents(); + // updateHeartbeat() while polling so we don't scare the deadlock watchdog + updateHeartbeat(); usleep(USECS_PER_MSEC * 50); // 20hz }