MAINT-8154 Disabled exception handling in LLAppViewer::frame() to get proper call stacks

master
AndreyL ProductEngine 2017-11-16 22:59:55 +02:00
parent 818c4a04b5
commit 691a72e2d2
3 changed files with 49 additions and 56 deletions

View File

@ -397,6 +397,8 @@ BOOL gCrashOnStartup = FALSE;
BOOL gLLErrorActivated = FALSE;
BOOL gLogoutInProgress = FALSE;
BOOL gSimulateMemLeak = FALSE;
////////////////////////////////////////////////////////////
// Internal globals... that should be removed.
@ -1540,6 +1542,35 @@ static LLTrace::BlockTimerStatHandle FTM_AGENT_UPDATE("Update");
LLTrace::BlockTimerStatHandle FTM_FRAME("Frame");
bool LLAppViewer::frame()
{
bool ret = false;
if (gSimulateMemLeak)
{
try
{
ret = doFrame();
}
catch (std::bad_alloc)
{
LLMemory::logMemoryInfo(TRUE);
LLFloaterMemLeak* mem_leak_instance = LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
if (mem_leak_instance)
{
mem_leak_instance->stop();
}
LL_WARNS() << "Bad memory allocation in LLAppViewer::frame()!" << LL_ENDL;
}
}
else
{
ret = doFrame();
}
return ret;
}
bool LLAppViewer::doFrame()
{
LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop"));
LLSD newFrame;
@ -1568,7 +1599,6 @@ bool LLAppViewer::frame()
//check memory availability information
checkMemory() ;
try
{
// <FS:Ansariel> MaxFPS Viewer-Chui merge error
// Check if we need to restore rendering masks.
@ -1617,12 +1647,15 @@ bool LLAppViewer::frame()
}
//memory leaking simulation
LLFloaterMemLeak* mem_leak_instance =
LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
if(mem_leak_instance)
if (gSimulateMemLeak)
{
mem_leak_instance->idle() ;
}
LLFloaterMemLeak* mem_leak_instance =
LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
if (mem_leak_instance)
{
mem_leak_instance->idle();
}
}
// canonical per-frame event
mainloop.post(newFrame);
@ -1809,60 +1842,13 @@ bool LLAppViewer::frame()
pingMainloopTimeout("Main:End");
}
}
catch (const LLContinueError&)
{
LOG_UNHANDLED_EXCEPTION("");
}
catch(std::bad_alloc)
{
LLMemory::logMemoryInfo(TRUE) ;
//stop memory leaking simulation
LLFloaterMemLeak* mem_leak_instance =
LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
if(mem_leak_instance)
{
mem_leak_instance->stop() ;
LL_WARNS() << "Bad memory allocation in LLAppViewer::frame()!" << LL_ENDL ;
}
else
{
//output possible call stacks to log file.
LLError::LLCallStacks::print() ;
LL_ERRS() << "Bad memory allocation in LLAppViewer::frame()!" << LL_ENDL ;
}
}
catch (...)
{
CRASH_ON_UNHANDLED_EXCEPTION("");
}
if (LLApp::isExiting())
{
// Save snapshot for next time, if we made it through initialization
if (STATE_STARTED == LLStartUp::getStartupState())
{
try
{
saveFinalSnapshot();
}
catch(std::bad_alloc)
{
LL_WARNS() << "Bad memory allocation when saveFinalSnapshot() is called!" << LL_ENDL ;
//stop memory leaking simulation
LLFloaterMemLeak* mem_leak_instance =
LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
if(mem_leak_instance)
{
mem_leak_instance->stop() ;
}
}
catch (...)
{
CRASH_ON_UNHANDLED_EXCEPTION("saveFinalSnapshot()");
}
saveFinalSnapshot();
}
// <FS:Ansariel> Cut down wait on logout; Need to terminate voice here because we need gServicePump!

View File

@ -234,6 +234,8 @@ protected:
private:
bool doFrame();
void initMaxHeapSize();
bool initThreads(); // Initialize viewer threads, return false on failure.
bool initConfiguration(); // Initialize settings from the command line/config file.
@ -443,4 +445,6 @@ extern LLUUID gBlackSquareID;
extern BOOL gRandomizeFramerate;
extern BOOL gPeriodicSlowFrame;
extern BOOL gSimulateMemLeak;
#endif // LL_LLAPPVIEWER_H

View File

@ -42,6 +42,8 @@ U32 LLFloaterMemLeak::sTotalLeaked = 0 ;
S32 LLFloaterMemLeak::sStatus = LLFloaterMemLeak::STOP ;
BOOL LLFloaterMemLeak::sbAllocationFailed = FALSE ;
extern BOOL gSimulateMemLeak;
LLFloaterMemLeak::LLFloaterMemLeak(const LLSD& key)
: LLFloater(key)
{
@ -104,6 +106,7 @@ void LLFloaterMemLeak::release()
sStatus = STOP ;
sTotalLeaked = 0 ;
sbAllocationFailed = FALSE ;
gSimulateMemLeak = FALSE;
}
void LLFloaterMemLeak::stop()
@ -140,8 +143,7 @@ void LLFloaterMemLeak::idle()
}
if(!p)
{
sStatus = STOP ;
sbAllocationFailed = TRUE ;
stop();
}
}
@ -181,6 +183,7 @@ void LLFloaterMemLeak::onChangeMaxMemLeaking()
void LLFloaterMemLeak::onClickStart()
{
sStatus = START ;
gSimulateMemLeak = TRUE;
}
void LLFloaterMemLeak::onClickStop()