Skip to content

Commit 50ea33b

Browse files
committed
#5084 Ressurect Watchdog
1 parent c62735a commit 50ea33b

File tree

5 files changed

+63
-29
lines changed

5 files changed

+63
-29
lines changed

indra/newview/app_settings/settings.xml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4484,13 +4484,24 @@
44844484
<key>MainloopTimeoutDefault</key>
44854485
<map>
44864486
<key>Comment</key>
4487-
<string>Timeout duration for mainloop lock detection, in seconds.</string>
4487+
<string>Timeout duration for mainloop lock detection during teleports, login and logout, in seconds.</string>
44884488
<key>Persist</key>
44894489
<integer>1</integer>
44904490
<key>Type</key>
44914491
<string>F32</string>
44924492
<key>Value</key>
4493-
<real>60.0</real>
4493+
<real>120.0</real>
4494+
</map>
4495+
<key>MainloopTimeoutStarted</key>
4496+
<map>
4497+
<key>Comment</key>
4498+
<string>Timeout duration for mainloop lock detection when logged in and not teleporting, in seconds.</string>
4499+
<key>Persist</key>
4500+
<integer>1</integer>
4501+
<key>Type</key>
4502+
<string>F32</string>
4503+
<key>Value</key>
4504+
<real>30.0</real>
44944505
</map>
44954506
<key>MapScale</key>
44964507
<map>
@@ -13862,13 +13873,13 @@
1386213873
<key>WatchdogEnabled</key>
1386313874
<map>
1386413875
<key>Comment</key>
13865-
<string>Controls whether the thread watchdog timer is activated. Value is boolean. Set to -1 to defer to built-in default.</string>
13876+
<string>Controls whether the thread watchdog timer is activated. Value is S32. Set to -1 to defer to built-in default.</string>
1386613877
<key>Persist</key>
1386713878
<integer>0</integer>
1386813879
<key>Type</key>
1386913880
<string>S32</string>
1387013881
<key>Value</key>
13871-
<integer>0</integer>
13882+
<integer>1</integer>
1387213883
</map>
1387313884
<key>WaterGLFogDensityScale</key>
1387413885
<map>

indra/newview/llappviewer.cpp

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3145,7 +3145,7 @@ bool LLAppViewer::initWindow()
31453145

31463146
// Need to load feature table before cheking to start watchdog.
31473147
bool use_watchdog = false;
3148-
int watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled");
3148+
S32 watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled");
31493149
if (watchdog_enabled_setting == -1)
31503150
{
31513151
use_watchdog = !LLFeatureManager::getInstance()->isFeatureAvailable("WatchdogDisabled");
@@ -5820,12 +5820,12 @@ void LLAppViewer::forceExceptionThreadCrash()
58205820
thread->start();
58215821
}
58225822

5823-
void LLAppViewer::initMainloopTimeout(std::string_view state, F32 secs)
5823+
void LLAppViewer::initMainloopTimeout(std::string_view state)
58245824
{
58255825
if (!mMainloopTimeout)
58265826
{
58275827
mMainloopTimeout = new LLWatchdogTimeout();
5828-
resumeMainloopTimeout(state, secs);
5828+
resumeMainloopTimeout(state);
58295829
}
58305830
}
58315831

@@ -5838,17 +5838,11 @@ void LLAppViewer::destroyMainloopTimeout()
58385838
}
58395839
}
58405840

5841-
void LLAppViewer::resumeMainloopTimeout(std::string_view state, F32 secs)
5841+
void LLAppViewer::resumeMainloopTimeout(std::string_view state)
58425842
{
58435843
if (mMainloopTimeout)
58445844
{
5845-
if (secs < 0.0f)
5846-
{
5847-
static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60.f);
5848-
secs = mainloop_timeout;
5849-
}
5850-
5851-
mMainloopTimeout->setTimeout(secs);
5845+
mMainloopTimeout->setTimeout(getMainloopTimeoutSec());
58525846
mMainloopTimeout->start(state);
58535847
}
58545848
}
@@ -5861,23 +5855,33 @@ void LLAppViewer::pauseMainloopTimeout()
58615855
}
58625856
}
58635857

5864-
void LLAppViewer::pingMainloopTimeout(std::string_view state, F32 secs)
5858+
void LLAppViewer::pingMainloopTimeout(std::string_view state)
58655859
{
58665860
LL_PROFILE_ZONE_SCOPED_CATEGORY_APP;
58675861

58685862
if (mMainloopTimeout)
58695863
{
5870-
if (secs < 0.0f)
5871-
{
5872-
static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60);
5873-
secs = mainloop_timeout;
5874-
}
5875-
5876-
mMainloopTimeout->setTimeout(secs);
5864+
mMainloopTimeout->setTimeout(getMainloopTimeoutSec());
58775865
mMainloopTimeout->ping(state);
58785866
}
58795867
}
58805868

5869+
5870+
F32 LLAppViewer::getMainloopTimeoutSec() const
5871+
{
5872+
if (LLStartUp::getStartupState() == STATE_STARTED
5873+
&& gAgent.getTeleportState() == LLAgent::TELEPORT_NONE)
5874+
{
5875+
static LLCachedControl<F32> mainloop_started(gSavedSettings, "MainloopTimeoutStarted", 15.f);
5876+
return mainloop_started();
5877+
}
5878+
else
5879+
{
5880+
static LLCachedControl<F32> mainloop_default(gSavedSettings, "MainloopTimeoutDefault", 120.f);
5881+
return mainloop_default();
5882+
}
5883+
}
5884+
58815885
void LLAppViewer::handleLoginComplete()
58825886
{
58835887
gLoggedInTime.start();

indra/newview/llappviewer.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,13 @@ class LLAppViewer : public LLApp
204204
// For thread debugging.
205205
// llstartup needs to control init.
206206
// llworld, send_agent_pause() also controls pause/resume.
207-
void initMainloopTimeout(std::string_view state, F32 secs = -1.0f);
207+
void initMainloopTimeout(std::string_view state);
208208
void destroyMainloopTimeout();
209209
void pauseMainloopTimeout();
210-
void resumeMainloopTimeout(std::string_view state = "", F32 secs = -1.0f);
211-
void pingMainloopTimeout(std::string_view state, F32 secs = -1.0f);
210+
void resumeMainloopTimeout(std::string_view state = "");
211+
void pingMainloopTimeout(std::string_view state);
212+
213+
F32 getMainloopTimeoutSec() const;
212214

213215
// Handle the 'login completed' event.
214216
// *NOTE:Mani Fix this for login abstraction!!

indra/newview/llappviewerwin32.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,17 @@ namespace
176176
LLAppViewer* app = LLAppViewer::instance();
177177
if (!app->isSecondInstance() && !app->errorMarkerExists())
178178
{
179-
// If marker doesn't exist, create a marker with 'other' code for next launch
179+
// If marker doesn't exist, create a marker with 'other' or 'logout' code for next launch
180180
// otherwise don't override existing file
181181
// Any unmarked crashes will be considered as freezes
182-
app->createErrorMarker(LAST_EXEC_OTHER_CRASH);
182+
if (app->logoutRequestSent())
183+
{
184+
app->createErrorMarker(LAST_EXEC_LOGOUT_CRASH);
185+
}
186+
else
187+
{
188+
app->createErrorMarker(LAST_EXEC_OTHER_CRASH);
189+
}
183190
}
184191
} // MDSCB_EXCEPTIONCODE
185192

indra/newview/llwatchdog.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "llviewerprecompiledheaders.h"
2929
#include "llwatchdog.h"
3030
#include "llthread.h"
31+
#include "llappviewer.h"
3132

3233
constexpr U32 WATCHDOG_SLEEP_TIME_USEC = 1000000U;
3334

@@ -240,7 +241,16 @@ void LLWatchdog::run()
240241
{
241242
mTimer->stop();
242243
}
243-
244+
if (LLAppViewer::instance()->logoutRequestSent())
245+
{
246+
LLAppViewer::instance()->createErrorMarker(LAST_EXEC_LOGOUT_FROZE);
247+
}
248+
else
249+
{
250+
LLAppViewer::instance()->createErrorMarker(LAST_EXEC_FROZE);
251+
}
252+
// Todo1: warn user?
253+
// Todo2: We probably want to report even if 5 seconds passed, just not error 'yet'.
244254
LL_ERRS() << "Watchdog timer expired; assuming viewer is hung and crashing" << LL_ENDL;
245255
}
246256
}

0 commit comments

Comments
 (0)