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/newview | |
parent | 8fd270af1cb7ee2cad7c47909b308ef31caf4cd3 (diff) |
Fixes for crash reporter startup race condition, crash reporter CPU use, Secondlife.log filehandle, XP Crash.
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llappviewer.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llappviewerwin32.cpp | 33 | ||||
-rwxr-xr-x | indra/newview/llfloaterspellchecksettings.cpp | 35 | ||||
-rwxr-xr-x | indra/newview/llfloaterspellchecksettings.h | 1 |
4 files changed, 45 insertions, 44 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 537142ebde..c31c0990c7 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1940,7 +1940,6 @@ bool LLAppViewer::cleanup() gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*"); } - removeDumpDir(); writeDebugInfo(); LLLocationHistory::getInstance()->save(); @@ -2102,6 +2101,14 @@ bool LLAppViewer::cleanup() llinfos << "Goodbye!" << llendflush; + //To preserve logfile on clean shutdown move to regular log dir. + std::string curr_log = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,"SecondLife.log"); + std::string last_log = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.log"); + LLError::logToFile(""); //Close Secondlife.log + LLFile::remove(last_log); + LLFile::copy(curr_log, last_log); + removeDumpDir(); + // return 0; return true; } @@ -2191,7 +2198,7 @@ void LLAppViewer::initLoggingAndGetLastDuration() // Get name of the log file std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SecondLife.log"); - /* + /* * Before touching any log files, compute the duration of the last run * by comparing the ctime of the previous start marker file with the ctime * of the last log file. @@ -2237,6 +2244,8 @@ void LLAppViewer::initLoggingAndGetLastDuration() // Rename current log file to ".old" LLFile::rename(log_file, old_log_file); + log_file = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, + "SecondLife.log"); // Set the log file to SecondLife.log LLError::logToFile(log_file); if (!duration_log_msg.empty()) @@ -3505,7 +3514,7 @@ void LLAppViewer::handleViewerCrash() LL_WARNS("MarkerFile") << "No gDirUtilp with which to create error marker file name" << LL_ENDL; } -#ifdef LL_WINDOWS //SPATTERS Wild guess that filename for Breakpad is not being returned due to sleep cycle in Crash Reporter. +#ifdef LL_WINDOWS Sleep(2000); #endif @@ -3514,12 +3523,9 @@ void LLAppViewer::handleViewerCrash() if(minidump_file && minidump_file[0] != 0) { gDebugInfo["Dynamic"]["MinidumpPath"] = minidump_file; - //SPATTERS another possibility is that when using OOP it must be initiated by a wrapping program so that when the - //viewer crashes, we are from a sibling thread than as a child. Might be able to request minidump at this point - //as a work-around. } #ifdef LL_WINDOWS - else //SPATTERS there is no else here in the older code + else { getFileList(); } diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index c861d0a99f..0e4efa34c7 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -276,7 +276,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash); #if LL_SEND_CRASH_REPORTS - ::SetUnhandledExceptionFilter(catchallCrashHandler); + // ::SetUnhandledExceptionFilter(catchallCrashHandler); #endif // Set a debug info flag to indicate if multiple instances are running. @@ -698,8 +698,35 @@ void LLAppViewerWin32::initCrashReporting(bool reportFreeze) { logdir = logdir.substr(0,end+1); } - std::string arg_str = "\"" + exe_path + "\" -dumpdir \"" + logdir + "\" -procname \"" + appname + "\" -pid " + stringize(LLApp::getPid()); - _spawnl(_P_NOWAIT, exe_path.c_str(), arg_str.c_str(), NULL); + //std::string arg_str = "\"" + exe_path + "\" -dumpdir \"" + logdir + "\" -procname \"" + appname + "\" -pid " + stringize(LLApp::getPid()); + //_spawnl(_P_NOWAIT, exe_path.c_str(), arg_str.c_str(), NULL); + std::string arg_str = "\"" + exe_path + "\" -dumpdir \"" + logdir + "\" -procname \"" + appname + "\" -pid " + stringize(LLApp::getPid()); + + STARTUPINFO startInfo={sizeof(startInfo)}; + PROCESS_INFORMATION processInfo; + + std::wstring exe_wstr; + exe_wstr=wstringize(exe_path); + + std::wstring arg_wstr; + arg_wstr=wstringize(arg_str); + + LL_INFOS("CrashReport") << "Creating crash reporter process " << exe_path << " with params: " << arg_str << LL_ENDL; + if(CreateProcess(exe_wstr.c_str(), + &arg_wstr[0], // Application arguments + 0, + 0, + FALSE, + CREATE_DEFAULT_ERROR_MODE, + 0, + 0, // Working directory + &startInfo, + &processInfo) == FALSE) + // Could not start application -> call 'GetLastError()' + { + LL_WARNS("CrashReport Launch") << "CreateProcess failed " << GetLastError() << LL_ENDL; + return; + } } //virtual diff --git a/indra/newview/llfloaterspellchecksettings.cpp b/indra/newview/llfloaterspellchecksettings.cpp index 5ecdd11918..54c7b4c37d 100755 --- a/indra/newview/llfloaterspellchecksettings.cpp +++ b/indra/newview/llfloaterspellchecksettings.cpp @@ -307,12 +307,12 @@ void LLFloaterSpellCheckerImport::onBtnOK() else { std::string settings_dic = LLSpellChecker::getDictionaryUserPath() + mDictionaryBasename + ".dic"; - if ( copyFile( dict_dic, settings_dic ) ) + if ( LLFile::copy( dict_dic, settings_dic ) ) { if (gDirUtilp->fileExists(dict_aff)) { std::string settings_aff = LLSpellChecker::getDictionaryUserPath() + mDictionaryBasename + ".aff"; - if (copyFile( dict_aff, settings_aff )) + if ( LLFile::copy( dict_aff, settings_aff )) { imported = true; } @@ -385,37 +385,6 @@ void LLFloaterSpellCheckerImport::onBtnOK() closeFloater(false); } -bool LLFloaterSpellCheckerImport::copyFile(const std::string from, const std::string to) -{ - bool copied = false; - LLFILE* in = LLFile::fopen(from, "rb"); /* Flawfinder: ignore */ - if (in) - { - LLFILE* out = LLFile::fopen(to, "wb"); /* Flawfinder: ignore */ - if (out) - { - char buf[16384]; /* Flawfinder: ignore */ - size_t readbytes; - bool write_ok = true; - while(write_ok && (readbytes = fread(buf, 1, 16384, in))) /* Flawfinder: ignore */ - { - if (fwrite(buf, 1, readbytes, out) != readbytes) - { - LL_WARNS("SpellCheck") << "Short write" << LL_ENDL; - write_ok = false; - } - } - if ( write_ok ) - { - copied = true; - } - fclose(out); - } - } - fclose(in); - return copied; -} - std::string LLFloaterSpellCheckerImport::parseXcuFile(const std::string& file_path) const { LLXMLNodePtr xml_root; diff --git a/indra/newview/llfloaterspellchecksettings.h b/indra/newview/llfloaterspellchecksettings.h index eded3a9133..de59d83f24 100755 --- a/indra/newview/llfloaterspellchecksettings.h +++ b/indra/newview/llfloaterspellchecksettings.h @@ -58,7 +58,6 @@ protected: void onBtnBrowse(); void onBtnCancel(); void onBtnOK(); - bool copyFile(const std::string from, const std::string to); std::string parseXcuFile(const std::string& file_path) const; std::string mDictionaryDir; |