Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions indra/newview/app_settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
42 changes: 23 additions & 19 deletions indra/newview/llappviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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);
}
}
Expand All @@ -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();
Expand Down
8 changes: 5 additions & 3 deletions indra/newview/llappviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,13 @@ class LLAppViewer : public LLApp
// 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!!
Expand Down
11 changes: 9 additions & 2 deletions indra/newview/llappviewerwin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 11 additions & 1 deletion indra/newview/llwatchdog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "llviewerprecompiledheaders.h"
#include "llwatchdog.h"
#include "llthread.h"
#include "llappviewer.h"

constexpr U32 WATCHDOG_SLEEP_TIME_USEC = 1000000U;

Expand Down Expand Up @@ -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;
}
}
Expand Down