diff options
author | Aura Linden <aura@lindenlab.com> | 2014-03-07 14:58:22 -0800 |
---|---|---|
committer | Aura Linden <aura@lindenlab.com> | 2014-03-07 14:58:22 -0800 |
commit | d2bb4dae980a887a30b206875d8f9419901ed66a (patch) | |
tree | dec6222ed82c5e105b69ae9ec64e5f379051734d /indra/llcrashlogger/llcrashlogger.cpp | |
parent | 8fd270af1cb7ee2cad7c47909b308ef31caf4cd3 (diff) |
Fixes for crash reporter startup race condition, crash reporter CPU use, Secondlife.log filehandle, XP Crash.
Diffstat (limited to 'indra/llcrashlogger/llcrashlogger.cpp')
-rwxr-xr-x | indra/llcrashlogger/llcrashlogger.cpp | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index bd34caf241..e66b7cbba4 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -218,21 +218,10 @@ void LLCrashLogger::gatherFiles() { // Figure out the filename of the second life log LLCurl::setCAFile(gDirUtilp->getCAFile()); - mFileMap["SecondLifeLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.log"); + mFileMap["SecondLifeLog"] = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,"SecondLife.log"); mFileMap["SettingsXml"] = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"settings.xml"); } - if(mCrashInPreviousExec) - { - // Restarting after freeze. - // Replace the log file ext with .old, since the - // instance that launched this process has overwritten - // SecondLife.log - std::string log_filename = mFileMap["SecondLifeLog"]; - log_filename.replace(log_filename.size() - 4, 4, ".old"); - mFileMap["SecondLifeLog"] = log_filename; - } - gatherPlatformSpecificFiles(); //Use the debug log to reconstruct the URL to send the crash report to @@ -271,7 +260,7 @@ void LLCrashLogger::gatherFiles() std::ifstream f((*itr).second.c_str()); if(!f.is_open()) { - std::cout << "Can't find file " << (*itr).second << std::endl; + LL_INFOS("CRASHREPORT") << "Can't find file " << (*itr).second << LL_ENDL; continue; } std::stringstream s; @@ -488,6 +477,12 @@ bool LLCrashLogger::sendCrashLogs() else { //mCrashInfo["DebugLog"].erase("MinidumpPath"); + //To preserve logfile on clean shutdown move to regular log dir. + std::string curr_log = (*lock)["dumpdir"].asString() + "SecondLife.log"; + std::string last_log = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.log"); + + LLFile::remove(last_log); + LLFile::rename(curr_log, last_log); //Before we blow away the directory, perserve log of previous run. mKeyMaster.cleanupProcess((*lock)["dumpdir"].asString()); } @@ -529,11 +524,25 @@ bool LLCrashLogger::init() // Default to the product name "Second Life" (this is overridden by the -name argument) mProductName = "Second Life"; + // Rename current log file to ".old" + std::string old_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "crashreport.log.old"); + std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "crashreport.log"); + +#if LL_WINDOWS + LLAPRFile::remove(old_log_file); +#endif + + LLFile::rename(log_file.c_str(), old_log_file.c_str()); + + // Set the log file to crashreport.log + LLError::logToFile(log_file); //NOTE: Until this line, LL_INFOS LL_WARNS, etc are blown to the ether. + // Handle locking - bool locked = mKeyMaster.requestMaster(); //Request maser locking file. wait time is defaulted to 300S + bool locked = mKeyMaster.requestMaster(); //Request master locking file. wait time is defaulted to 300S while (!locked && mKeyMaster.isWaiting()) { + LL_INFOS("CRASHREPORT") << "Waiting for lock." << LL_ENDL; #if LL_WINDOWS Sleep(1000); #else @@ -544,22 +553,9 @@ bool LLCrashLogger::init() if (!locked) { - llwarns << "Unable to get master lock. Another crash reporter may be hung." << llendl; + LL_WARNS("CRASHREPORT") << "Unable to get master lock. Another crash reporter may be hung." << LL_ENDL; return false; } - - // Rename current log file to ".old" - std::string old_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "crashreport.log.old"); - std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "crashreport.log"); - -#if LL_WINDOWS - LLAPRFile::remove(old_log_file); -#endif - - LLFile::rename(log_file.c_str(), old_log_file.c_str()); - - // Set the log file to crashreport.log - LLError::logToFile(log_file); mCrashSettings.declareS32("CrashSubmitBehavior", CRASH_BEHAVIOR_ALWAYS_SEND, "Controls behavior when viewer crashes " @@ -587,5 +583,6 @@ bool LLCrashLogger::init() // For cleanup code common to all platforms. void LLCrashLogger::commonCleanup() { + LLError::logToFile(""); //close crashreport.log LLProxy::cleanupClass(); } |