diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-01-03 22:57:28 +0200 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-01-04 21:13:06 +0200 |
commit | 51088cde7f5a0bdaf9249bfdd5d31b9b212403ab (patch) | |
tree | 9ce6bfdfca3321b7beed6049ab246e0685b4428d /indra/newview | |
parent | 096156d16ce0461c173b1bd925a97e7c41a042e5 (diff) |
SL-17896 Don't crash silently if files are missing or out of memory
Under debug LL_ERRS will show a message as well, but release won't show
anything and will quit silently so show a notification when applicable.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappcorehttp.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 29 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 1 | ||||
-rw-r--r-- | indra/newview/llavatarrenderinfoaccountant.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llmeshrepository.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 16 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 13 |
8 files changed, 67 insertions, 9 deletions
diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index debf93dccd..51e259992d 100644 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -168,6 +168,7 @@ void LLAppCoreHttp::init() } else { + LLError::LLUserWarningMsg::showMissingFiles(); LL_ERRS("Init") << "Missing CA File; should be at " << ca_file << LL_ENDL; } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 47bff547fe..38888b4424 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -362,7 +362,6 @@ BOOL gRandomizeFramerate = FALSE; BOOL gPeriodicSlowFrame = FALSE; BOOL gCrashOnStartup = FALSE; -BOOL gLLErrorActivated = FALSE; BOOL gLogoutInProgress = FALSE; BOOL gSimulateMemLeak = FALSE; @@ -2246,9 +2245,6 @@ void errorCallback(LLError::ELevel level, const std::string &error_string) OSMessageBox(error_string, LLTrans::getString("MBFatalError"), OSMB_OK); #endif - //Set the ErrorActivated global so we know to create a marker file - gLLErrorActivated = true; - gDebugInfo["FatalMessage"] = error_string; // We're not already crashing -- we simply *intend* to crash. Since we // haven't actually trashed anything yet, we can afford to write the whole @@ -2257,6 +2253,14 @@ void errorCallback(LLError::ELevel level, const std::string &error_string) } } +void errorMSG(const std::string& title_string, const std::string& message_string) +{ + if (!message_string.empty()) + { + OSMessageBox(message_string, title_string.empty() ? LLTrans::getString("MBFatalError") : title_string, OSMB_OK); + } +} + void LLAppViewer::initLoggingAndGetLastDuration() { // @@ -2268,6 +2272,8 @@ void LLAppViewer::initLoggingAndGetLastDuration() LLError::addGenericRecorder(&errorCallback); //LLError::setTimeFunction(getRuntime); + LLError::LLUserWarningMsg::setHandler(errorMSG); + if (mSecondInstance) { @@ -2405,6 +2411,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, { // failed to load if(file.required) { + LLError::LLUserWarningMsg::showMissingFiles(); LL_ERRS() << "Error: Cannot load required settings file from: " << full_settings_path << LL_ENDL; return false; } @@ -2503,6 +2510,7 @@ bool LLAppViewer::initConfiguration() if (!success) { LL_WARNS() << "Cannot load default configuration file " << settings_file_list << LL_ENDL; + LLError::LLUserWarningMsg::showMissingFiles(); if (gDirUtilp->fileExists(settings_file_list)) { LL_ERRS() << "Cannot load default configuration file settings_files.xml. " @@ -2526,6 +2534,7 @@ bool LLAppViewer::initConfiguration() if (!mSettingsLocationList->validateBlock()) { + LLError::LLUserWarningMsg::showMissingFiles(); LL_ERRS() << "Invalid settings file list " << settings_file_list << LL_ENDL; } @@ -2960,6 +2969,8 @@ bool LLAppViewer::initConfiguration() LLEventPumps::instance().obtain("LLControlGroup").post(LLSDMap("init", key)); } + LLError::LLUserWarningMsg::setOutOfMemoryStrings(LLTrans::getString("MBOutOfMemoryTitle"), LLTrans::getString("MBOutOfMemoryErr")); + return true; // Config was successful. } @@ -2997,6 +3008,7 @@ void LLAppViewer::initStrings() // initial check to make sure files are there failed gDirUtilp->dumpCurrentDirectories(LLError::LEVEL_WARN); + LLError::LLUserWarningMsg::showMissingFiles(); LL_ERRS() << "Viewer failed to find localization and UI files." << " Please reinstall viewer from https://secondlife.com/support/downloads" << " and contact https://support.secondlife.com if issue persists after reinstall." << LL_ENDL; @@ -4304,6 +4316,7 @@ void LLAppViewer::loadKeyBindings() key_bindings_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "key_bindings.xml"); if (!gViewerInput.loadBindingsXML(key_bindings_file)) { + LLError::LLUserWarningMsg::showMissingFiles(); LL_ERRS("InitInfo") << "Unable to open default key bindings from " << key_bindings_file << LL_ENDL; } } @@ -5394,6 +5407,14 @@ void LLAppViewer::forceErrorLLError() LL_ERRS() << "This is a deliberate llerror" << LL_ENDL; } +void LLAppViewer::forceErrorLLErrorMsg() +{ + LLError::LLUserWarningMsg::show("Deliberate error"); + // Note: under debug this will show a message as well, + // but release won't show anything and will quit silently + LL_ERRS() << "This is a deliberate llerror with a message" << LL_ENDL; +} + void LLAppViewer::forceErrorBreakpoint() { LL_WARNS() << "Forcing a deliberate breakpoint" << LL_ENDL; diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 6d1496d517..77a1cdb485 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -152,6 +152,7 @@ public: // LLAppViewer testing helpers. // *NOTE: These will potentially crash the viewer. Only for debugging. virtual void forceErrorLLError(); + virtual void forceErrorLLErrorMsg(); virtual void forceErrorBreakpoint(); virtual void forceErrorBadMemoryAccess(); virtual void forceErrorInfiniteLoop(); diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index a6c9a41fa4..b95b971890 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -339,6 +339,7 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio } catch (std::bad_alloc&) { + LLError::LLUserWarningMsg::showOutOfMemory(); LL_ERRS() << "LLCoros::launch() allocation failure" << LL_ENDL; } } @@ -370,6 +371,7 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi } catch (std::bad_alloc&) { + LLError::LLUserWarningMsg::showOutOfMemory(); LL_ERRS() << "LLCoros::launch() allocation failure" << LL_ENDL; } } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 1398c1acdb..48fd946a21 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1360,7 +1360,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry) U8* buffer = new(std::nothrow) U8[size]; if (!buffer) { - LL_WARNS_ONCE(LOG_MESH) << "Failed to allocate memory for skin info, size: " << size << LL_ENDL; + LL_WARNS(LOG_MESH) << "Failed to allocate memory for skin info, size: " << size << LL_ENDL; return false; } LLMeshRepository::sCacheBytesRead += size; @@ -1473,7 +1473,7 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) U8* buffer = new(std::nothrow) U8[size]; if (!buffer) { - LL_WARNS_ONCE(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL; + LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL; return false; } LLMeshRepository::sCacheBytesRead += size; @@ -1575,7 +1575,7 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) U8* buffer = new(std::nothrow) U8[size]; if (!buffer) { - LL_WARNS_ONCE(LOG_MESH) << "Failed to allocate memory for physics shape, size: " << size << LL_ENDL; + LL_WARNS(LOG_MESH) << "Failed to allocate memory for physics shape, size: " << size << LL_ENDL; return false; } file.read(buffer, size); @@ -1770,7 +1770,7 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, U8* buffer = new(std::nothrow) U8[size]; if (!buffer) { - LL_WARNS_ONCE(LOG_MESH) << "Can't allocate memory for mesh " << mesh_id << " LOD " << lod << ", size: " << size << LL_ENDL; + LL_WARNS(LOG_MESH) << "Can't allocate memory for mesh " << mesh_id << " LOD " << lod << ", size: " << size << LL_ENDL; // todo: for now it will result in indefinite constant retries, should result in timeout // or in retry-count and disabling mesh. (but usually viewer is beyond saving at this point) return false; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 007e3440b9..90066b205e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -289,6 +289,7 @@ void handle_disconnect_viewer(void *); void force_error_breakpoint(void *); void force_error_llerror(void *); +void force_error_llerror_msg(void*); void force_error_bad_memory_access(void *); void force_error_infinite_loop(void *); void force_error_software_exception(void *); @@ -2372,6 +2373,15 @@ class LLAdvancedForceErrorLlerror : public view_listener_t } }; +class LLAdvancedForceErrorLlerrorMsg: public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + force_error_llerror_msg(NULL); + return true; + } +}; + class LLAdvancedForceErrorBadMemoryAccess : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -8384,6 +8394,11 @@ void force_error_llerror(void *) LLAppViewer::instance()->forceErrorLLError(); } +void force_error_llerror_msg(void*) +{ + LLAppViewer::instance()->forceErrorLLErrorMsg(); +} + void force_error_bad_memory_access(void *) { LLAppViewer::instance()->forceErrorBadMemoryAccess(); @@ -9622,6 +9637,7 @@ void initialize_menus() // Advanced > Debugging view_listener_t::addMenu(new LLAdvancedForceErrorBreakpoint(), "Advanced.ForceErrorBreakpoint"); view_listener_t::addMenu(new LLAdvancedForceErrorLlerror(), "Advanced.ForceErrorLlerror"); + view_listener_t::addMenu(new LLAdvancedForceErrorLlerrorMsg(), "Advanced.ForceErrorLlerrorMsg"); view_listener_t::addMenu(new LLAdvancedForceErrorBadMemoryAccess(), "Advanced.ForceErrorBadMemoryAccess"); view_listener_t::addMenu(new LLAdvancedForceErrorBadMemoryAccessCoro(), "Advanced.ForceErrorBadMemoryAccessCoro"); view_listener_t::addMenu(new LLAdvancedForceErrorInfiniteLoop(), "Advanced.ForceErrorInfiniteLoop"); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 7e26faf4da..6d2768c9ac 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2729,6 +2729,12 @@ function="World.EnvPreset" function="Advanced.ForceErrorLlerror" /> </menu_item_call> <menu_item_call + label="Force LLError, Message And Crash" + name="Force LLError And Crash"> + <menu_item_call.on_click + function="Advanced.ForceErrorLlerrorMsg" /> + </menu_item_call> + <menu_item_call label="Force Bad Memory Access" name="Force Bad Memory Access"> <menu_item_call.on_click diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 22a8ced530..f20bdeca17 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3020,8 +3020,19 @@ Running in window. If you continue to receive this message, contact the [SUPPORT_SITE]. </string> + <string name="MBOutOfMemoryTitle">Out Of Memory</string> + <string name="MBOutOfMemoryErr"> + [APP_NAME]'s request for memory failed. Application can't proceed and will be closed. - <!-- Avatar Shape Information --> +If your computer's RAM is low, quit any heavy applications before runing Second Life, allocate a page file or reduce graphical settings like draw distance. + </string> + <string name="MBMissingFile"> + [APP_NAME] couldn't access or find some of the files it needs and will be closed. + +Please reinstall viewer from https://secondlife.com/support/downloads/ and contact https://support.secondlife.com if issue persists after reinstall. + </string> + + <!-- Avatar Shape Information --> <string name="5 O'Clock Shadow">5 O'Clock Shadow</string> <string name="All White">All White</string> |