summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-12-02 00:44:56 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-12-02 15:44:32 +0200
commit7991ae892ef0f717636c0fe3c0eff0a5f92e6bb8 (patch)
tree982bcc1ced0ed78185c6d5115119c4e30eea1818 /indra
parentc62735adc8fa5a31f6c306c6919c7e32e956976d (diff)
#5084 Ressurect Watchdog
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/settings.xml19
-rw-r--r--indra/newview/llappviewer.cpp42
-rw-r--r--indra/newview/llappviewer.h8
-rw-r--r--indra/newview/llappviewerwin32.cpp11
-rw-r--r--indra/newview/llwatchdog.cpp12
5 files changed, 63 insertions, 29 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 3dbb5dca1f..fe31a00ba3 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -4484,13 +4484,24 @@
<key>MainloopTimeoutDefault</key>
<map>
<key>Comment</key>
- <string>Timeout duration for mainloop lock detection, in seconds.</string>
+ <string>Timeout duration for mainloop lock detection during teleports, login and logout, in seconds.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
- <real>60.0</real>
+ <real>120.0</real>
+ </map>
+ <key>MainloopTimeoutStarted</key>
+ <map>
+ <key>Comment</key>
+ <string>Timeout duration for mainloop lock detection when logged in and not teleporting, in seconds.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>30.0</real>
</map>
<key>MapScale</key>
<map>
@@ -13862,13 +13873,13 @@
<key>WatchdogEnabled</key>
<map>
<key>Comment</key>
- <string>Controls whether the thread watchdog timer is activated. Value is boolean. Set to -1 to defer to built-in default.</string>
+ <string>Controls whether the thread watchdog timer is activated. Value is S32. Set to -1 to defer to built-in default.</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
- <integer>0</integer>
+ <integer>1</integer>
</map>
<key>WaterGLFogDensityScale</key>
<map>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 72bfdcf83c..f6f5f1717b 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3145,7 +3145,7 @@ bool LLAppViewer::initWindow()
// Need to load feature table before cheking to start watchdog.
bool use_watchdog = false;
- int watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled");
+ S32 watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled");
if (watchdog_enabled_setting == -1)
{
use_watchdog = !LLFeatureManager::getInstance()->isFeatureAvailable("WatchdogDisabled");
@@ -5820,12 +5820,12 @@ void LLAppViewer::forceExceptionThreadCrash()
thread->start();
}
-void LLAppViewer::initMainloopTimeout(std::string_view state, F32 secs)
+void LLAppViewer::initMainloopTimeout(std::string_view state)
{
if (!mMainloopTimeout)
{
mMainloopTimeout = new LLWatchdogTimeout();
- resumeMainloopTimeout(state, secs);
+ resumeMainloopTimeout(state);
}
}
@@ -5838,17 +5838,11 @@ void LLAppViewer::destroyMainloopTimeout()
}
}
-void LLAppViewer::resumeMainloopTimeout(std::string_view state, F32 secs)
+void LLAppViewer::resumeMainloopTimeout(std::string_view state)
{
if (mMainloopTimeout)
{
- if (secs < 0.0f)
- {
- static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60.f);
- secs = mainloop_timeout;
- }
-
- mMainloopTimeout->setTimeout(secs);
+ mMainloopTimeout->setTimeout(getMainloopTimeoutSec());
mMainloopTimeout->start(state);
}
}
@@ -5861,23 +5855,33 @@ void LLAppViewer::pauseMainloopTimeout()
}
}
-void LLAppViewer::pingMainloopTimeout(std::string_view state, F32 secs)
+void LLAppViewer::pingMainloopTimeout(std::string_view state)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_APP;
if (mMainloopTimeout)
{
- if (secs < 0.0f)
- {
- static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60);
- secs = mainloop_timeout;
- }
-
- mMainloopTimeout->setTimeout(secs);
+ mMainloopTimeout->setTimeout(getMainloopTimeoutSec());
mMainloopTimeout->ping(state);
}
}
+
+F32 LLAppViewer::getMainloopTimeoutSec() const
+{
+ if (LLStartUp::getStartupState() == STATE_STARTED
+ && gAgent.getTeleportState() == LLAgent::TELEPORT_NONE)
+ {
+ static LLCachedControl<F32> mainloop_started(gSavedSettings, "MainloopTimeoutStarted", 30.f);
+ return mainloop_started();
+ }
+ else
+ {
+ static LLCachedControl<F32> mainloop_default(gSavedSettings, "MainloopTimeoutDefault", 120.f);
+ return mainloop_default();
+ }
+}
+
void LLAppViewer::handleLoginComplete()
{
gLoggedInTime.start();
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index c12b2e83ef..61c206bcec 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -204,11 +204,13 @@ public:
// For thread debugging.
// llstartup needs to control init.
// llworld, send_agent_pause() also controls pause/resume.
- void initMainloopTimeout(std::string_view state, F32 secs = -1.0f);
+ void initMainloopTimeout(std::string_view state);
void destroyMainloopTimeout();
void pauseMainloopTimeout();
- void resumeMainloopTimeout(std::string_view state = "", F32 secs = -1.0f);
- void pingMainloopTimeout(std::string_view state, F32 secs = -1.0f);
+ void resumeMainloopTimeout(std::string_view state = "");
+ void pingMainloopTimeout(std::string_view state);
+
+ F32 getMainloopTimeoutSec() const;
// Handle the 'login completed' event.
// *NOTE:Mani Fix this for login abstraction!!
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index a951338138..0620b625d9 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -176,10 +176,17 @@ namespace
LLAppViewer* app = LLAppViewer::instance();
if (!app->isSecondInstance() && !app->errorMarkerExists())
{
- // If marker doesn't exist, create a marker with 'other' code for next launch
+ // If marker doesn't exist, create a marker with 'other' or 'logout' code for next launch
// otherwise don't override existing file
// Any unmarked crashes will be considered as freezes
- app->createErrorMarker(LAST_EXEC_OTHER_CRASH);
+ if (app->logoutRequestSent())
+ {
+ app->createErrorMarker(LAST_EXEC_LOGOUT_CRASH);
+ }
+ else
+ {
+ app->createErrorMarker(LAST_EXEC_OTHER_CRASH);
+ }
}
} // MDSCB_EXCEPTIONCODE
diff --git a/indra/newview/llwatchdog.cpp b/indra/newview/llwatchdog.cpp
index bf171fe954..614d1afc2a 100644
--- a/indra/newview/llwatchdog.cpp
+++ b/indra/newview/llwatchdog.cpp
@@ -28,6 +28,7 @@
#include "llviewerprecompiledheaders.h"
#include "llwatchdog.h"
#include "llthread.h"
+#include "llappviewer.h"
constexpr U32 WATCHDOG_SLEEP_TIME_USEC = 1000000U;
@@ -240,7 +241,16 @@ void LLWatchdog::run()
{
mTimer->stop();
}
-
+ if (LLAppViewer::instance()->logoutRequestSent())
+ {
+ LLAppViewer::instance()->createErrorMarker(LAST_EXEC_LOGOUT_FROZE);
+ }
+ else
+ {
+ LLAppViewer::instance()->createErrorMarker(LAST_EXEC_FROZE);
+ }
+ // Todo1: warn user?
+ // Todo2: We probably want to report even if 5 seconds passed, just not error 'yet'.
LL_ERRS() << "Watchdog timer expired; assuming viewer is hung and crashing" << LL_ENDL;
}
}