Watchdog still runs but doesn't abort on timeout. Also fixes for previous tracing improvements.
Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -399,7 +399,8 @@ public: · 398 unmodified lines | ||
| 399 | 399 | static const int HEARTBEAT_SAMPLES = 100000; // ~5 seconds worth of samples |
| 400 | 400 | |
| 401 | 401 | // Set the heartbeat on launch |
| 402 | − DeadlockWatchdogThread() { | |
| 402 | + DeadlockWatchdogThread(bool crashOnTrigger = true) | |
| 403 | + : _crashOnTrigger(crashOnTrigger) { | |
| 403 | 404 | setObjectName("Deadlock Watchdog"); |
| 404 | 405 | // Give the heartbeat an initial value |
| 405 | 406 | _heartbeat = usecTimestampNow(); |
| @@ -490,7 +491,9 @@ public: · 84 unmodified lines | ||
| 490 | 491 | // Don't actually crash in debug builds, in case this apparent deadlock is simply from |
| 491 | 492 | // the developer actively debugging code |
| 492 | 493 | #ifdef NDEBUG |
| 494 | + if (_crashOnTrigger) { | |
| 493 | 495 | deadlockDetectionCrash(); |
| 496 | + } | |
| 494 | 497 | #endif |
| 495 | 498 | } |
| 496 | 499 | } |
| @@ -502,6 +505,8 @@ public: · 5 unmodified lines | ||
| 502 | 505 | static std::atomic<int> _maxElapsedAverage; |
| 503 | 506 | static ThreadSafeMovingAverage<int, HEARTBEAT_SAMPLES> _movingAverage; |
| 504 | 507 | |
| 508 | + const bool _crashOnTrigger; | |
| 509 | + | |
| 505 | 510 | bool _quit { false }; |
| 506 | 511 | }; |
| 507 | 512 | |
| @@ -957,7 +962,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 449 unmodified lines | ||
| 957 | 962 | auto steamClient = PluginManager::getInstance()->getSteamClientPlugin(); |
| 958 | 963 | setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning())); |
| 959 | 964 | setProperty(hifi::properties::CRASHED, _previousSessionCrashed); |
| 960 | − | |
| 965 | + bool watchdogCrashWhenTriggered = true; | |
| 961 | 966 | { |
| 962 | 967 | const QString TEST_SCRIPT = "--testScript"; |
| 963 | 968 | const QStringList args = arguments(); |
| @@ -967,6 +972,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 3 unmodified lines | ||
| 967 | 972 | if (QFileInfo(testScriptPath).exists()) { |
| 968 | 973 | setProperty(hifi::properties::TEST, QUrl::fromLocalFile(testScriptPath)); |
| 969 | 974 | } |
| 975 | + } else if (args.at(i) == QStringLiteral("--disableWatchdog")) { | |
| 976 | + watchdogCrashWhenTriggered = false; | |
| 970 | 977 | } |
| 971 | 978 | } |
| 972 | 979 | } |
| @@ -1014,7 +1021,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 41 unmodified lines | ||
| 1014 | 1021 | |
| 1015 | 1022 | // Set up a watchdog thread to intentionally crash the application on deadlocks |
| 1016 | 1023 | if (!DISABLE_WATCHDOG) { |
| 1017 | − (new DeadlockWatchdogThread())->start(); | |
| 1024 | + (new DeadlockWatchdogThread(watchdogCrashWhenTriggered))->start(); | |
| 1018 | 1025 | } |
| 1019 | 1026 | |
| 1020 | 1027 | // Set File Logger Session UUID |