From a7d507e9fd51a37e99f2fff1e429f1933aea7c39 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 29 Sep 2017 10:37:21 -0700 Subject: [PATCH] Disable watchdog with environment variable --- interface/src/Application.cpp | 11 ++++++++--- interface/src/Application.h | 2 -- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 85172fc73f..fcae7430a8 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -289,6 +289,10 @@ static QTimer locationUpdateTimer; static QTimer identityPacketTimer; static QTimer pingTimer; +static const QString DISABLE_WATCHDOG_FLAG("HIFI_DISABLE_WATCHDOG"); +static bool DISABLE_WATCHDOG = QProcessEnvironment::systemEnvironment().contains(DISABLE_WATCHDOG_FLAG); + + static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16; // For processing on QThreadPool, we target a number of threads after reserving some @@ -805,8 +809,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo nodeList->startThread(); // Set up a watchdog thread to intentionally crash the application on deadlocks - _deadlockWatchdogThread = new DeadlockWatchdogThread(); - _deadlockWatchdogThread->start(); + if (!DISABLE_WATCHDOG) { + (new DeadlockWatchdogThread())->start(); + } if (steamClient) { qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << steamClient->getSteamVRBuildID(); @@ -1933,7 +1938,7 @@ void Application::showCursor(const Cursor::Icon& cursor) { } void Application::updateHeartbeat() const { - static_cast(_deadlockWatchdogThread)->updateHeartbeat(); + DeadlockWatchdogThread::updateHeartbeat(); } void Application::onAboutToQuit() { diff --git a/interface/src/Application.h b/interface/src/Application.h index 74e84ae92c..0819555584 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -650,8 +650,6 @@ private: Qt::CursorShape _desiredCursor{ Qt::BlankCursor }; bool _cursorNeedsChanging { false }; - QThread* _deadlockWatchdogThread; - std::map> _postUpdateLambdas; std::mutex _postUpdateLambdasLock;