summaryrefslogtreecommitdiff
path: root/indra/llcommon
AgeCommit message (Collapse)Author
2020-09-25SL-13034 Last string in logs should say 'Goodbye'Andrey Kleshchev
These logs were not logging for very long due to supressed logging system, no point showing them now
2020-09-25SL-13979 Crash of logging system at LLError::Settings::getInstance()Andrey Kleshchev
LLSingleton depends onto logging system, having logging system be based on LLSingleton causes crashes and deadlocks
2020-07-28Nat's suggested improvement to LLThreadSafeQueue that takes account of queue ↵Callum Prentice
being empty as well as the status flag condition
2020-07-22Put hash for boost namespace properly into that by using namespace boostNicky Dasmijn
2020-07-22Linux needs strcmp , include <string.h> so we get access to that function.Nicky Dasmijn
2020-07-20Merge branch 'master' into DRTVWR-501-maintAndrey Lihatskiy
# Conflicts: # autobuild.xml # indra/newview/llimprocessing.cpp
2020-07-14Fixed -Wstring-plus-int related errors for compatibility with Xcode-11.4Brad Kittenbrink
2020-07-07DRTVWR-476, SL-13555: Don't crash if user closes viewer during login.Nat Goodspeed
Ever since February 2010, the body of the login coroutine function has been enclosed in try/catch (...), with an llerrs message to try to crash more informatively than the runtime's unhandled-exception termination. Over the years this evolved to LL_ERRS and then to CRASH_ON_UNHANDLED_EXCEPTION. This persisted despite the August 2016 addition of generic catch clauses in the LLCoros::toplevel() function to serve the same purpose, and despite the subsequent introduction of the LLCoros::Stop family of exceptions to deliberately throw into waiting coroutines on viewer shutdown. That's exactly what was happening. When the user closed the viewer while waiting for the response from login.cgi, the waiting operation threw LLCoros::Stopping, which was caught by that CRASH_ON_UNHANDLED_EXCEPTION, which crashed the viewer with LL_ERRS rather than propagating up to the toplevel() and cleanly terminating the coroutine. Change CRASH_ON_UNHANDLED_EXCEPTION() to LOG_UNHANDLED_EXCEPTION() and re-throw so toplevel() can handle.
2020-07-01SL-13361: Enable color processing on Windows 10 debug console.Nat Goodspeed
(cherry picked from commit 0b61150e698537a7e42a4cdae02496da500399d9)
2020-06-26DRTVWR-476, SL-13512: Fix flawed fix for former failure.Nat Goodspeed
Specifically, llcoro::suspendUntilTimeout() is definitely called concurrently by multiple coroutines. New code that instantiates a local LLEventStream must allow the name to be tweaked for uniqueness.
2020-06-25DRTVWR-476, SL-13512: Make suspendUntilTimeout() notice shutdown.Nat Goodspeed
Specifically, the shutdown crash reported in SL-13512 was due to LLExperienceCache::idleCoro() looping on suspendUntilTimeout(), failing to notice in its slumbers that the viewer was shutting down around it. Make suspendUntilTimeout() internally call suspendUntilEventOnWithTimeout(), which already listens for "LLApp" state-change events and throws Stopping when LLApp enters its shutdown sequence.
2020-06-23Reverted SL-6109 keybinding changesAndrey Kleshchev
Changes were moved to DRTVWR-514
2020-06-15SL-13418 Added converter from old mouse binding settings to new onesAndrey Kleshchev
2020-05-27DRTVWR-476: LLMainThreadTask cross-thread test hangs. Skip.Nat Goodspeed
2020-05-20DRTVWR-476: Add LLThreadSafeQueue::tryPushFrontFor().Nat Goodspeed
tryPushFrontFor() is pushFront() with a std::chrono::duration timeout.
2020-05-14DRTVWR-476: Wrap boost::fibers::mutex et al. with LLCoros aliases.Nat Goodspeed
Specifically: LLCoros::Mutex means boost::fibers::mutex LLCoros::LockType means std::unique_lock<boost::fibers::mutex> LLCoros::ConditionVariable means boost::fibers::condition_variable LLCoros::cv_status means boost::fibers::cv_status So as not to drag in all of boost::fibers::mutex.hpp or condition_variable.hpp for each consumer of llcoros.h, instead #define LLCOROS_MUTEX_HEADER and LLCOROS_CONDVAR_HEADER. Those who need them can #include the relevant macro. Update llcond.h and llthreadsafequeue.h accordingly.
2020-05-14DRTVWR-476: Make LLSDFormatter::OPTIONS_PRETTY_BINARY uppercaseNat Goodspeed
for compatibility with Python llbase.llsd.parse(). The Python parse() currently requires uppercase hex digits for b16"hex" coding; lowercase hex digits cause it to raise LLSDParseError.
2020-05-14DRTVWR-476: Fix LLError::Log::classname(T*) template function.Nat Goodspeed
First, the signature classname(const T*) was wrong: that function could only accept a pointer to const T. The expression classname(someptr) where someptr was a pointer to non-const SomeType displayed "SomeType*" because it could only match classname(const T&), where T was SomeType*. classname(T* const) is what we should have written, meaning "const pointer to T" rather than "pointer to const T." Second, the previous implementation failed to handle the case in which the pointer was nullptr.
2020-05-13DRTVWR-476: Default LLSDNotationFormatter now OPTIONS_PRETTY_BINARY.Nat Goodspeed
LLSDNotationFormatter (also LLSDNotationStreamer that uses it, plus operator<<(std::ostream&, const LLSD&) that uses LLSDNotationStreamer) is most useful for displaying LLSD to a human, e.g. for logging. Having the default dump raw binary bytes into the log file is not only suboptimal, it can truncate the output if one of those bytes is '\0'. (This is a problem with the logging subsystem, but that's a story for another day.) Use OPTIONS_PRETTY_BINARY wherever there is a default LLSDFormatter ::EFormatterOptions argument. Also, allow setting LLSDFormatter subclass boolalpha(), realFormat() and format(options) using optional constructor arguments. Naturally, each subclass that supports this must accept and forward these constructor arguments to its LLSDFormatter base class constructor. Fix a couple bugs in LLSDNotationFormatter::format_impl() for an LLSD::Binary value with OPTIONS_PRETTY_BINARY: - The code unconditionally emitted a b(len) type prefix followed by either raw binary or hex, depending on the option flag. OPTIONS_PRETTY_BINARY caused it to emit "0x" before the hex representation of the data. This is wrong in that it can't be read back by either the C++ or the Python LLSD parser. Correct OPTIONS_PRETTY_BINARY formatting consists of b16"hex digits" rather than b(len)"raw bytes". - Although the code did set hex mode, it didn't set either the field width or the fill character, so that a byte value less than 16 would emit a single digit rather than two. Instead of having one LLSDFormatter::format() method with an optional options argument, declare two overloads. The format() overload without options passes the mOptions data member to the overload accepting options. Refactor the LLSDFormatter family, hoisting the recursive format_impl() method (accepting level) to a pure virtual method at LLSDFormatter base-class level. Most subclasses therefore need not override either base-class format() method, only format_impl(). In fact the short format() overload isn't even virtual. Consistently use LLSDFormatter::EFormatterOptions enum as the options parameter wherever such options are accepted.
2020-05-06DRTVWR-476: Add llsd::clone(), llsd::shallow() aliasesNat Goodspeed
for new llsd_clone(), llsd_shallow() functions.
2020-05-06DRTVWR-476: Merge branch 'master' of lindenlab/viewer into DRTVWR-476-boost-1.72Nat Goodspeed
2020-04-29Merge branch 'DRTVWR-500' into DRTVWR-501-maintAndrey Lihatskiy
2020-04-21AMD CPUs list updateAndrey Lihatskiy
2020-04-20Merge branch 'master' into DRTVWR-500Andrey Lihatskiy
# Conflicts: # indra/newview/pipeline.cpp
2020-04-03DRTVWR-476: Facilitate debugging test programs with logging.Nat Goodspeed
On Mac, even if you run a test program with --debug or set LOGTEST=DEBUG, it won't log to stderr if you're filtering build output or running the build in an emacs compile buffer. This is because, on Mac, a viewer launched by mouse rather than from the command line is passed a stderr stream that ultimately gets logged to the system Console. The shouldLogToStderr() function is intended to avoid spamming the Console with the (voluminous) viewer log output. It tests whether stderr isatty() and, if not, suppresses calling LLError::logToStderr(). This makes debugging test programs using log output trickier than necessary. Change shouldLogToStderr() to permit logging when either stderr isatty() or is a pipe. The original intention is preserved in that empirically, a viewer launched by mouse is passed a stderr stream identified as a character device rather than as a pipe. Also introduce SetEnv, a class that facilitates setting (e.g.) LOGTEST=DEBUG for specific test programs without setting it for all test programs in the build. Using the constructor for a static object means you can set environment variables before main() is entered, which is important because it's the main() function in test.cpp that acts on the LOGTEST and LOGFAIL environment variables. These changes make it unnecessary to retain the temporary change in test.cpp to force LOGTEST to DEBUG.
2020-04-03DRTVWR-476: Cherry-pick debug aids from commit 77b0c53 (fiber-mutex)Nat Goodspeed
2020-03-26DRTVWR-476: Apparently it can take more than 2s for threads to chat.Nat Goodspeed
llmainthreadtask_test builds in a Sync timeout to keep build-time tests from hanging. That timeout was set to 2000ms, which seems as though it ought to be plenty enough time for a process with only 2 threads to exchange data between them. But on TeamCity EC2 Windows build hosts, sometimes we hit that timeout and fail. Extend it to try to improve the robustness of builds, even though the possibility of a production viewer blocking for that long for anything seems worrisome. (Fortunately the production viewer does not use Sync.)
2020-03-25DRTVWR-476: Introduce LLThreadSafeQueue::close().Nat Goodspeed
Also isClosed() and explicit operator bool() to detect closed state. close() causes every subsequent pushFront() to throw LLThreadSafeQueueInterrupt. Once the queue is drained, it causes popBack() to throw likewise.
2020-03-25DRTVWR-476: make printActiveCoroutines() output slightly clearer.Nat Goodspeed
For the main coroutine on each thread, show the 'main0' (or whatever) name instead of the empty-string name.
2020-03-25DRTVWR-476: Re-enable LLInstanceTracker tests disabled months ago.Nat Goodspeed
2020-03-25DRTVWR-476: Log calls to LLParamSingleton::initParamSingleton().Nat Goodspeed
2020-03-25DRTVWR-476: Update LLMainThreadTask tests for simpler API.Nat Goodspeed
2020-03-25DRTVWR-476: Fix merge glitch.Nat Goodspeed
2020-03-25DRTVWR-476: On Windows, use prebuilt Boost.Stacktrace.Nat Goodspeed
2020-03-25DRTVWR-476: Adapt LLInstanceTracker::snapshot for VS limitations.Nat Goodspeed
2020-03-25DRTVWR-476: Add unit tests for LLMainThreadTask.Nat Goodspeed
Now that we have the Sync class to help construct unit tests that move forward in a deterministic stepwise order, we can build suitable unit tests for LLMainThreadTask.
2020-03-25DRTVWR-476: LLTHROW() requires LLException or subclass.Nat Goodspeed
2020-03-25DRTVWR-476: Make llcoro::logname() distinguish different threads.Nat Goodspeed
Actually, introduce static LLCoros::logname() and make the namespaced free function an alias for that. Because CoroData is a subclass of LLInstanceTracker with a key, every instance requires a distinct key. That conflicts with our "getName() returns empty string for default coroutine on thread" convention. Introduce a new CoroData constructor, specifically for the default coroutine on each thread, that initializes the getName() name to empty string while providing a distinct "mainN" key. Make get_CoroData() use that new constructor for its thread_local instance, passing an atomic<int> incremented each time we initialize one for a new thread. Then LLCoros::logname() returns either the getName() name or the key.
2020-03-25DRTVWR-476: Adjust LLCoros to new LLInstanceTracker API.Nat Goodspeed
2020-03-25DRTVWR-476, SL-12197: Don't throw Stopping from main coroutine.Nat Goodspeed
The new LLCoros::Stop exception is intended to terminate long-lived coroutines -- not interrupt mainstream shutdown processing. Only throw it on an explicitly-launched coroutine. Make LLCoros::getName() (used by the above test) static. As with other LLCoros methods, it might be called after the LLCoros LLSingleton instance has been deleted. Requiring the caller to call instance() implies a possible need to also call wasDeleted(). Encapsulate that nuance into a static method instead.
2020-03-25DRTVWR-476: Enrich LLExceptions thrown by LLTHROW() with stack trace.Nat Goodspeed
The LLTHROW() abstraction allows us to enrich the subject exception with a boost::stacktrace -- without having to propagate the boost/stacktrace.hpp header throughout the code base. To my delight, our existing use of boost::current_exception_diagnostic_information() already reports the newly added boost::stacktrace information -- we don't have to query it specifically!
2020-03-25DRTVWR-476: Add LLTHROW()/LOG_UNHANDLED_EXCEPTION() test.Nat Goodspeed
llexception_test.cpp is about discovering appropriate infrastructure to get good information from the LLTHROW() and LOG_UNHANDLED_EXCEPTION() mechanism. But we didn't before have a test that actually exercises them. Now we do.
2020-03-25DRTVWR-476: Introduce LLStacktrace, a token to stream stack trace.Nat Goodspeed
LLStacktrace has no behavior except when you stream an instance to a std::ostream. Then it reports the current traceback at that point to the ostream. This bit of indirection is intended to avoid the boost/stacktrace.hpp header from being included everywhere.
2020-03-25DRTVWR-476: Make LLThreadSafeQueue coroutine-safe as well.Nat Goodspeed
2020-03-25DRTVWR-476: Back out 355d9db4a59f: unroll stderr redirection.Nat Goodspeed
2020-03-25DRTVWR-476: Back out e913c05d43b6: unroll stderr redirection.Nat Goodspeed
2020-03-25DRTVWR-476: Back out e66ec842b851: unrolling stderr redirection.Nat Goodspeed
2020-03-25DRTVWR-476: Partially revert 978e09882565: undo using LLTempRedirect.Nat Goodspeed
But leave LLTempRedirect available in the code base.
2020-03-25DRTVWR-476: Don't test configuration.emptyMap().Nat Goodspeed
LLSD::emptyMap() is a factory for an empty map instance, NOT a predicate on any particular instance. In fact checking configuration.isUndefined() and testing whether the map is empty are both subsumed by (! configuration).
2020-03-25DRTVWR-476: Always clear both fields even if mOrigTarget invalid.Nat Goodspeed