summaryrefslogtreecommitdiff
path: root/indra/llcommon
AgeCommit message (Collapse)Author
2022-02-11SL-10190: Slightly reduce conditional clutter in llcoros.{h,cpp}.Nat Goodspeed
Rename 'winlevel()' to 'sehandle()'; change it from a static member function to a free function, thus eliminating the conditional in llcoros.h. Elsewhere than Windows, provide a zero-cost pass-through sehandle() implementation, eliminating the conditional in toplevel(). # Conflicts: # indra/llcommon/llcoros.cpp # indra/llcommon/llcoros.h
2022-02-11SL-10190: Introduce LLCoros::saveException() and rethrow().Nat Goodspeed
This mechanism uses a queue of std::exception_ptrs to transport an (otherwise) uncaught exception from a terminated coroutine to the thread's main fiber. The main loop calls LLCoros::rethrow() just after giving some cycles to ready coroutines that frame. # Conflicts: # indra/llcommon/llcoros.cpp # indra/llcommon/llcoros.h # indra/newview/llappviewer.cpp
2022-02-11Revert "SL-14961 Coroutine crash was not reported to bugsplat"Andrey Kleshchev
Will be replaced with retrow from nat
2022-02-05SL-16799 Clean up use of hardcoded folder namesAndrey Kleshchev
2022-01-26OPEN-358 Readable errorAndrey Kleshchev
2021-11-16Merge branch 'master' into DRTVWR-519Andrey Lihatskiy
# Conflicts: # README.md
2021-10-13Merge with master after latest Viewer releaseCallum Linden
2021-10-14Merge branch 'master' into DRTVWR-545-maint-mixAndrey Lihatskiy
2021-09-28Revert "Merge branch 'c++17' into DRTVWR-522-maint"Andrey Lihatskiy
This reverts commit 203ea3a70a775a09cbbffb1740ab7c58f1780baa, reversing changes made to 8e3f0778863a5aa337d1148a243ea91d238a8ac5. # Conflicts: # indra/newview/llmachineid.cpp
2021-09-03Merge branch 'DRTVWR-522-maint' into DRTVWR-545-maint-mixAndrey Lihatskiy
# Conflicts: # indra/newview/llappviewer.cpp # indra/newview/llappviewerwin32.cpp # indra/newview/llmachineid.cpp
2021-08-27Merge branch 'c++17' into DRTVWR-522-maintAndrey Lihatskiy
2021-08-12Merge branch 'master' into DRTVWR-520-apple-notarizationAndrey Lihatskiy
# Conflicts: # autobuild.xml # build.sh # indra/CMakeLists.txt # indra/newview/CMakeLists.txt # indra/newview/llappviewermacosx.cpp # indra/newview/llappviewerwin32.h # indra/newview/viewer_manifest.py # indra/win_crash_logger/llcrashloggerwindows.cpp
2021-07-20Merge branch 'master' into DRTVWR-521-maintAndrey Lihatskiy
# Conflicts: # autobuild.xml # indra/llcommon/llerror.cpp # indra/llui/llnotifications.h # indra/newview/llappviewer.cpp # indra/newview/llappviewermacosx.cpp
2021-07-19Merge with tip of Master after a Viewer releaseCallum Prentice
2021-07-19SL-15292 Voice's singleton shutdown before voice's coroutineAndrey Kleshchev
2021-07-19Merge branch 'master' into DRTVWR-522-maintAndrey Lihatskiy
# Conflicts: # doc/contributions.txt # indra/newview/llappcorehttp.cpp # indra/newview/llappcorehttp.h
2021-06-29DRTVWR-538: Merge branch 'master' into c++17Nat Goodspeed
2021-06-07Merge with tip of Master after Viewer releaseCallum Prentice
2021-06-07Merge branch 'master' into DRTVWR-522-maintAndrey Lihatskiy
2021-06-07Merge branch 'master' into DRTVWR-521-maintAndrey Lihatskiy
# Conflicts: # doc/contributions.txt
2021-06-07Merge branch 'master' into DRTVWR-520-apple-notarizationAndrey Lihatskiy
2021-06-07Merge branch 'master' into DRTVWR-516-maintAndrey Lihatskiy
2021-06-03SL-15272 Bugsplat crashes at condition wait()Andrey Kleshchev
Made sure all waits will be triggered, won't loop back and that in case of http queue it had some time to trigger
2021-05-31SL-15093 Crash nanov2_free_to_block #2Andrey Kleshchev
Mostly converted some boost pointers to std ones Made ~LLNotificationChannelBase() more explicit to get a bit more data on location of another crash that likely happens when cleaning mItems
2021-05-28SL-15093 Crash nanov2_free_to_blockAndrey Kleshchev
Superficially crash happens in disconnect() inside signal's deconstructor. Manual cleanup should help figuring out if crash happens due to named or anonymous listeners
2021-05-21SL-15272 Bugsplat crashes at condition wait()Andrey Kleshchev
Made sure all waits will be triggered, won't loop back and that in case of http queue it had some time to trigger
2021-05-21Merge branch 'sl-10297' into DRTVWR-516-maintAndrey Lihatskiy
2021-05-17SL-15200: Add LLApp::sleep(duration) methods.Nat Goodspeed
Two sleep() methods: one accepting F32Milliseconds, or in general any LLUnits time class; the other accepting any std::chrono::duration. The significant thing about each of these sleep() methods, as opposed to any freestanding sleep() function, is that it only sleeps until the app starts shutdown. Moreover, it returns true if it slept for the whole specified duration, false if it woke for app shutdown. This is accomplished by making LLApp::sStatus be an LLScalarCond<EAppStatus> instead of a plain EAppStatus enum, and by making setStatus() call set_all() each time the value changes. Then each new sleep() method can call wait_for_unequal(duration, APP_STATUS_RUNNING). Introducing llcond.h into llapp.h triggered an #include circularity because llthread.h #included llapp.h even though it didn't reference anything from it. Removed. This, in turn, necessitated adding #include "llapp.h" to several .cpp files that reference LLApp but had been depending on other header files to drag in llapp.h.
2021-05-13SL-15258: Remove additional std library features dropped with C++17.Nat Goodspeed
2021-05-12SL-10297: Use initializer_list<std::string> vs. <std::string_view>.Nat Goodspeed
This is somewhat more expensive for string literals, but switching to std::string_view implies more extensive changes, to be considered separately.
2021-05-12SL-10297: #include <string_view> in llsingleton.hNat Goodspeed
2021-05-12SL-10297: Merge branch 'sl-10297-oz' into sl-10297.Nat Goodspeed
Bring in Oz's tweaks to the way BugSplat is engaged and tested, plus a few other miscellaneous goodies.
2021-05-12SL-10297: Get rid of LLError::LLCallStacks::allocateStackBuffer().Nat Goodspeed
Also freeStackBuffer() and all the funky classic-C string management of a big flat buffer divided into exactly 512 128-byte strings. Define StringVector as a std::vector<std::string>, and use that instead. Retain the behavior of clearing the vector if it exceeds 512 entries. This eliminates the LLError::Log::flush(const std::ostringstream&, char*) overload as well, with its baffling mix of std::string and classic-C (e.g. strlen(out.str().c_str()). If we absolutely MUST use a big memory pool for performance reasons, let's use StringVector with allocators.
2021-05-12SL-10297: Eliminate llerror.cpp's Globals::messageStream and bool.Nat Goodspeed
Instead of a single std::ostringstream instance shared by all callers, even those on different threads, make each of the relevant lllog_test_() and llcallstacks macros instantiate independent (stack) std::ostringstream objects. lllog_test_() is called by LL_DEBUGS(), LLINFOS(), LL_WARNS(), LL_ERRS(), LL_VLOGS() et al. Eliminate LLError::Log::out(), whose sole function was to arbitrate use of that shared std::ostringstream. Amusingly, if the lock couldn't be locked or if messageStreamInUse was set, out() would allocate a new (heap!) std::ostringstream anyway, which would then have to be freed by flush(). Make both LLError::Log::flush() overloads accept const std::ostringstream&. Make LL_ENDL pass the local _out instance. This eliminates the need to check whether the passed std::ostringstream* references the shared instance and (if so) reset it or (if not) delete it. Make LLError::LLCallStacks::insert() accept the local _out instance as non- const std::ostream&, rather than acquiring and returning std::ostringstream*. Make end() accept the local instance as const std::ostringstream&.
2021-05-12SL-10297: Simplify implementation of LLSingletonBase::logwarns() etc.Nat Goodspeed
Introduce 'string_params' typedef for std::initialization_list<std::string>, and make logwarns(), loginfos(), logdebugs() and logerrs() accept const string_params&. Eliminate the central log() function in llsingleton.cpp that used LL_VLOGS(). To cache the result of a (moderately expensive) Log::shouldLog() call, LL_VLOGS() wants its CallSite object to be static -- but of course the shouldLog() result will differ for different ELevel values, so LL_VLOGS() instantiates a static array of CallSite instances. It seems silly to funnel distinct logwarns(), etc., functions through a common log() function only to have LL_VLOGS() tease apart ELevel values again. Instead, make logwarns() directly invoke LL_WARNS(), and similarly for the rest. To reduce boilerplate in these distinct functions, teach std::ostream how to stream a string_params instance by looping over its elements. Then each logwarns(), etc., function can simply stream its string_params argument to LL_WARNS() or whichever. In particular, eliminate the LLERROR_CRASH macro in logerrs(). The fact that it invokes LL_ERRS() ensures that its LL_ENDL macro will crash the viewer.
2021-05-11SL-10297: Move LL_ERRS crash location into the LL_ERRS macro itself.Nat Goodspeed
Introduce Oz's LLERROR_CRASH macro analogous to the old LLError::crashAndLoop() function. Change LL_ENDL macro so that, after calling flush(), if the CallSite is for LEVEL_ERROR, we invoke LLERROR_CRASH right there. Change the meaning of LLError::FatalFunction. It used to be responsible for the actual crash (hence crashAndLoop()). Now, instead, its role is to disrupt control flow in some other way if you DON'T want to crash: throw an exception, or call exit() or some such. Any FatalFunction that returns normally will fall into the new crash in LL_ENDL. Accordingly, the new default FatalFunction is a no-op lambda. This eliminates the need to test for empty (not set) FatalFunction in Log::flush(). Remove LLError::crashAndLoop() because the official LL_ERRS crash is now in LL_ENDL. One of the two common use cases for setFatalFunction() used to be to intercept control in the last moments before crashing -- not to crash or to avoid crashing, but to capture the LL_ERRS message in some way. Especially when that's temporary, though (e.g. LLLeap), saving and restoring the previous FatalFunction only works when the lifespans of the relevant objects are strictly LIFO. Either way, that's a misuse of FatalFunction. Fortunately the Recorder mechanism exactly addresses that case. Introduce a GenericRecorder template subclass, with LLError::addGenericRecorder(callable) that accepts a callable with suitable (level, message) signature, instantiates a GenericRecorder, adds it to the logging machinery and returns the RecorderPtr for possible later use with removeRecorder(). Change llappviewer.cpp's errorCallback() to an addGenericRecorder() callable. Its role was simply to update gDebugInfo["FatalMessage"] with the LL_ERRS message, then call writeDebugInfo(), before calling crashAndLoop() to finish crashing. Remove the crashAndLoop() call, retaining the gDebugInfo logic. Pass errorCallback() to LLError::addGenericRecorder() instead of setFatalFunction(). Oddly, errorCallback()'s crashAndLoop() call was conditional on a compile-time SHADER_CRASH_NONFATAL symbol. The new mechanism provides no way to support SHADER_CRASH_NONFATAL -- it is a Bad Idea to return normally from any LL_ERRS invocation! Rename LLLeapImpl::fatalFunction() to onError(). Instead of passing it to LLError::setFatalFunction(), pass it to addGenericRecorder(). Capture the returned RecorderPtr in mRecorder, replacing mPrevFatalFunction. Then ~LLLeapImpl() calls removeRecorder(mRecorder) instead of restoring mPrevFatalFunction (which, as noted above, was order-sensitive). Of course, every enabled Recorder is called with every log message. onError() and errorCallback() must specifically test for calls with LEVEL_ERROR. LLSingletonBase::logerrs() used to call LLError::getFatalFunction(), check the return and call it if non-empty, else call LLError::crashAndLoop(). Replace all that with LLERROR_CRASH. Remove from llappviewer.cpp the watchdog_llerrs_callback() and watchdog_killer_callback() functions. watchdog_killer_callback(), passed to Watchdog::init(), used to setFatalFunction(watchdog_llerrs_callback) and then invoke LL_ERRS() -- which seems a bit roundabout. watchdog_llerrs_callback(), in turn, replicated much of the logic in the primary errorCallback() function before replicating the crash from llwatchdog.cpp's default_killer_callback(). Instead, pass LLWatchdog::init() a lambda that invokes the LL_ERRS() message formerly found in watchdog_killer_callback(). It no longer needs to override FatalFunction with watchdog_llerrs_callback() because errorCallback() will still be called as a Recorder, obviating watchdog_llerrs_callback()'s first half; and LL_ENDL will handle the crash, obviating the second half. Remove from llappviewer.cpp the static fast_exit() function, which was simply an alias for _exit() acceptable to boost::bind(). Use a lambda directly calling _exit() instead of using boost::bind() at all. In the CaptureLog class in llcommon/tests/wrapllerrs.h, instead of statically referencing the wouldHaveCrashed() function from test.cpp, simply save and restore the current FatalFunction across the LLError::saveAndResetSettings() call. llerror_test.cpp calls setFatalFunction(fatalCall), where fatalCall() was a function that simply set a fatalWasCalled bool rather than actually crashing in any way. Of course, that implementation would now lead to crashing the test program. Make fatalCall() throw a new FatalWasCalled exception. Introduce a CATCH(LL_ERRS("tag"), "message") macro that expands to: LL_ERRS("tag") << "message" << LL_ENDL; within a try/catch block that catches FatalWasCalled and sets the same bool. Change all existing LL_ERRS() in llerror_test.cpp to corresponding CATCH() calls. In fact there's also an LL_DEBUGS(bad tag) invocation that exercises an LL_ERRS internal to llerror.cpp; wrap that too.
2021-05-10SL-10297: Make LLSingletonBase::llerrs() et al. runtime variadic.Nat Goodspeed
Instead of accepting a fixed list of (const char* p1="", etc.), accept (std::initializer_list<std::string_view>). Accepting a std::initializer_list<T> in your parameter list allows coding (e.g.) func({T0, T1, T2, ... }); -- in other words, you can pass the initializer_list a brace-enclosed list of an arbitrary number of instances of T. Using std::string_view instead of const char* means we can pass *either* const char* or std::string. string_view is cheaply constructed from either, allowing uniform treatment within the function. Constructing string_view from std::string simply extracts the pointer and length from the std::string. Constructing string_view from const char* (e.g. a "string literal") requires scanning the string for its terminating nul byte -- but that would be necessary even if the scan were deferred until the function body. Since string_view stores the length, the scan still happens only once.
2021-04-30Merge branch 'master' into DRTVWR-520-apple-notarizationAndrey Lihatskiy
2021-04-30Merge branch 'master' into DRTVWR-522-maintAndrey Lihatskiy
# Conflicts: # doc/contributions.txt
2021-04-30Merge branch 'master' into DRTVWR-521-maintAndrey Lihatskiy
2021-04-29Clean up a merge conflictCallum Prentice
2021-04-29Merge master (DRTVWR-515) into DRTVWR-516-maintAndrey Kleshchev
# Conflicts: # autobuild.xml # doc/contributions.txt # indra/llcommon/llcoros.cpp # indra/llmessage/llcoproceduremanager.cpp # indra/newview/llfloaterfixedenvironment.cpp # indra/newview/llfloaterimsessiontab.cpp
2021-04-29Merge master into DV525-merge-6.4.19Dave Houlton
2021-04-26SL-15170 remove mac_crash_loggerMnikolenko ProductEngine
2021-04-23build fixMnikolenko ProductEngine
2021-04-01Merge branch 'master' into DRTVWR-519Callum Prentice
2021-04-01Merge branch 'master' into DV525-merge-6.4.18Dave Houlton
2021-04-01Merge branch 'master' into DRTVWR-522-maintAndrey Lihatskiy
# Conflicts: # indra/newview/lltoolpie.cpp
2021-04-01Merge branch 'master' into DRTVWR-521-maintAndrey Lihatskiy
2021-04-01Merge branch 'master' into DRTVWR-520-apple-notarizationAndrey Lihatskiy
# Conflicts: # autobuild.xml