Commit Graph

40429 Commits (bd008a170898e69beeb8bc0481b4bfd94de86c55)

Author SHA1 Message Date
Nat Goodspeed dd73274c8a DRTVWR-494: Streamline LLEventTimer::updateClass().
No need to capture a separate list of completed LLEventTimer instances to
delete after the primary loop, since at this point we're looping over a
snapshot and can directly delete each completed timer.
2019-12-03 11:36:04 -05:00
Nat Goodspeed 4a861a1466 DRTVWR-494: Add on_main_thread(), sibling to assert_main_thread(). 2019-12-03 11:33:55 -05:00
andreykproductengine d3f389a38c SL-12326 Textures' apr pool crash fix 2019-11-26 17:21:43 +02:00
Nat Goodspeed a9cf349de4 DRTVWR-494: Improve thread safety of LLSingleton machinery.
Remove warnings about LLSingleton not being thread-safe because, at this point,
we have devoted considerable effort to trying to make it thread-safe.

Add LLSingleton<T>::Locker, a nested class which both provides a function-
static mutex and a scoped lock that uses it. Instantiating Locker, which has a
nullary constructor, replaces the somewhat cumbersome idiom of declaring a
std::unique_lock<std::recursive_mutex> lk(getMutex);

This eliminates (or rather, absorbs) the typedefs and getMutex() method from
LLParamSingleton. Replace explicit std::unique_lock declarations in
LLParamSingleton methods with Locker declarations.

Remove LLSingleton<T>::SingletonInitializer nested struct. Instead of
getInstance() relying on function-static initialization to protect (only)
constructSingleton() calls, explicitly use a Locker instance to cover its
whole scope, and make the UNINITIALIZED case call constructSingleton().
Rearrange cases so that after constructSingleton(), control falls through to
the CONSTRUCTED case and the finishInitializing() call.

Use a Locker instance in other public-facing methods too: instanceExists(),
wasDeleted(), ~LLSingleton(). Make destructor protected so it can only be called
via deleteSingleton() (but must be accessible to subclasses for overrides).

Remove LLSingletonBase::get_master() and get_initializing(), which permitted
directly manipulating the master list and the initializing stack without any
locking mechanism. Replace with get_initializing_size().

Similarly, replace LLSingleton_manage_master::get_initializing() with
get_initializing_size(). Use in constructSingleton() in place of
get_initializing().size().

Remove LLSingletonBase::capture_dependency()'s list_t parameter, which
accepted the list returned by get_initializing(). Encapsulate that retrieval
within the scope of the new lock in capture_dependency().

Add LLSingleton_manage_master::capture_dependency(LLSingletonBase*, EInitState)
to forward (or not) a call to LLSingletonBase::capture_dependency(). Nullary
LLSingleton<T>::capture_dependency() calls new LLSingleton_manage_master method.

Equip LLSingletonBase::MasterList with a mutex of its own, separate from the
one donated by the LLSingleton machinery, to serialize use of MasterList data
members. Introduce MasterList::Lock nested class to lock the MasterList mutex
while providing a reference to the MasterList instance. Introduce subclasses
LockedMaster, which provides a reference to the actual mMaster master list
while holding the MasterList lock; and LockedInitializing, which does the same
for the initializing list. Make mMaster and get_initializing_() private so
that consuming code can *only* access those lists via LockedInitializing and
LockedMaster.

Make MasterList::cleanup_initializing_() private, with a LockedInitializing
public forwarding method. This avoids another call to MasterList::instance(),
and also mandates that the lock is currently held during every call.

Similarly, move LLSingletonBase::log_initializing() to a LockedInitializing
log() method.
(transplanted from dca0f16266c7bddedb51ae7d7dca468ba87060d5)
2019-11-23 22:18:45 -05:00
Nat Goodspeed b22c41c8c5 DRTVWR-494: Quiet VS warnings about its own <mutex> header. 2019-12-02 15:40:02 -05:00
Nat Goodspeed b2913b7cf1 DRTVWR-494: Defend LLInstanceTracker against multi-thread usage.
The previous implementation went to some effort to crash if anyone attempted
to create or destroy an LLInstanceTracker subclass instance during traversal.
That restriction is manageable within a single thread, but becomes unworkable
if it's possible that a given subclass might be used on more than one thread.

Remove LLInstanceTracker::instance_iter, beginInstances(), endInstances(),
also key_iter, beginKeys() and endKeys(). Instead, introduce key_snapshot()
and instance_snapshot(), the only means of iterating over LLInstanceTracker
instances. (These are intended to resemble functions, but in fact the current
implementation simply presents the classes.) Iterating over a captured
snapshot defends against container modifications during traversal. The term
'snapshot' reminds the coder that a new instance created during traversal will
not be considered. To defend against instance deletion during traversal, a
snapshot stores std::weak_ptrs which it lazily dereferences, skipping on the
fly any that have expired.

Dereferencing instance_snapshot::iterator gets you a reference rather than a
pointer. Because some use cases want to delete all existing instances, add an
instance_snapshot::deleteAll() method that extracts the pointer. Those cases
used to require explicitly copying instance pointers into a separate
container; instance_snapshot() now takes care of that. It remains the caller's
responsibility to ensure that all instances of that LLInstanceTracker subclass
were allocated on the heap.

Replace unkeyed static LLInstanceTracker::getInstance(T*) -- which returned
nullptr if that instance had been destroyed -- with new getWeak() method
returning std::weak_ptr<T>. Caller must detect expiration of that weak_ptr.

Adjust tests accordingly.

Use of std::weak_ptr to detect expired instances requires engaging
std::shared_ptr in the constructor. We now store shared_ptrs in the static
containers (std::map for keyed, std::set for unkeyed).

Make LLInstanceTrackerBase a template parameterized on the type of the static
data it manages. For that reason, hoist static data class declarations out of
the class definitions to an LLInstanceTrackerStuff namespace.

Remove the static atomic sIterationNestDepth and its methods incrementDepth(),
decrementDepth() and getDepth(), since they were used only to forbid creation
and destruction during traversal.

Add a std::mutex to static data. Introduce an internal LockStatic class that
locks the mutex while providing a pointer to static data, making that the only
way to access the static data.

The LLINSTANCETRACKER_DTOR_NOEXCEPT macro goes away because we no longer
expect ~LLInstanceTracker() to throw an exception in test programs.
That affects LLTrace::StatBase as well as LLInstanceTracker itself.

Adapt consumers to the new LLInstanceTracker API.
2019-12-02 14:39:24 -05:00
Nat Goodspeed 4cb6e9ee08 DRTVWR-494: Show copy-paste-friendly env vars and test command.
Moderately often I want to copy the (long) integration test program path from
build output and rerun the test program by hand. But typically we need
environment variables set as well so it can find its dynamic libraries. This
has resulted in my copying parts of several lines of build output, then
pasting to a command prompt, then hand-tweaking the pasted text so it makes
sense as a command.

Streamline run_build_test.py output so less hand-tweaking is needed.
2019-11-23 22:16:39 -05:00
Nat Goodspeed 95c6b512e1 DRTVWR-476, SL-12197: Don't throw Stopping from main coroutine.
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.
2019-11-22 11:58:27 -05:00
Nat Goodspeed e0b2d4c623 DRTVWR-476: Clean up mangled merge from SL-11216. 2019-11-21 17:27:32 -05:00
Nat Goodspeed aab532b859 DRTVWR-476,SL-11215,SL-11216: Update to viewer-manager build 533067 2019-11-21 17:01:16 -05:00
Nat Goodspeed 1cdcf2c780 Automated merge with ssh://bitbucket.org/nat_linden/viewer-sl-11216 2019-11-21 17:00:09 -05:00
Nat Goodspeed 7ec95ca3cb Automated merge with ssh://bitbucket.org/nat_linden/viewer-sl-11215 2019-11-21 16:57:01 -05:00
Nat Goodspeed f5b8019281 SL-11216: Merge up to current viewer-release 2019-11-21 16:52:10 -05:00
Nat Goodspeed 1cf9b1c279 Automated merge with ssh://bitbucket.org/lindenlab/viewer-release 2019-11-21 16:26:37 -05:00
andreykproductengine 3d88b2587d SL-12322 addTriangle crash 2019-11-21 17:49:03 +02:00
AndreyL ProductEngine 8a0338bda0 Backed out changeset: 3ea1714b65b8 2019-11-20 21:41:27 +02:00
Nat Goodspeed ec31248dfc DRTVWR-476: Enrich LLExceptions thrown by LLTHROW() with stack trace.
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!
2019-11-18 20:22:45 -05:00
Nat Goodspeed e87eed54b0 DRTVWR-476: Add LLTHROW()/LOG_UNHANDLED_EXCEPTION() test.
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.
2019-11-18 20:17:01 -05:00
Nat Goodspeed 9e58f09096 DRTVWR-476: Introduce LLStacktrace, a token to stream stack trace.
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.
2019-11-18 18:43:01 -05:00
Nat Goodspeed f0440a05c2 DRTVWR-476: Have to package libhunspell dylib now, not .a lib. 2019-11-15 10:43:17 -05:00
Nat Goodspeed 03e09e960b DRTVWR-476: Remove diagnostics around 'SetFile -a V' commands.
Earlier versions of macOS manifested frustrating problems in finishing the
built package. Those build steps seem to have been behaving better for a few
years now. Eliminate (what we fervently hope has become) a bit of ancient cruft.
2019-11-15 10:38:23 -05:00
Nat Goodspeed a6cd80f8bf DRTVWR-476: Introduce LLCoprocedureManager::close(). Use in tests.
The new close(void) method simply acquires the logic from
~LLCoprocedureManager() (which now calls close()). It's useful, even if only
in test programs, to be able to shut down all existing LLCoprocedurePools
without having to name them individually -- and without having to destroy the
LLCoprocedureManager singleton instance. Deleting an LLSingleton should be
done only once per process, whereas test programs want to reset the
LLCoprocedureManager after each test.
2019-11-15 08:17:04 -05:00
Nat Goodspeed a8ef51170d DRTVWR-476: Conflate LOGFAIL env var empty with completely unset.
Sometimes it's useful to be able to temporarily override an existing LOGFAIL
setting in the current environment. It's far more convenient to prepend
LOGFAIL='' to a command than to 'unset LOGFAIL' as a whole separate command --
and then remember to restore its previous value.
2019-11-15 08:11:32 -05:00
Nat Goodspeed f967287f8f DRTVWR-476: Use LLThreadSafeQueue, not boost::fibers::buffered_channel.
We've observed buffered_channel::try_push() hanging, which seems very odd. Try
our own LLThreadSafeQueue instead.
2019-11-14 16:45:39 -05:00
Nat Goodspeed 01552519a0 DRTVWR-476: Make LLThreadSafeQueue coroutine-safe as well. 2019-11-14 16:40:51 -05:00
Nat Goodspeed f8807298a2 DRTVWR-476: Manually count items in LLCoprocedurePool's pending queue.
Reinstate LLCoprocedureManager::countPending() and count() methods. These were
removed because boost::fibers::buffered_channel has no size() method, but
since all users run within a single thread, it works to increment and
decrement a simple counter.

Add count information and max queue size to log messages.
2019-11-14 15:40:06 -05:00
AndreyL ProductEngine 7ffe8d0a51 SL-11964 Removed SL Share from the viewer 2019-11-13 05:32:05 +02:00
Nat Goodspeed 3b1dce4d3f DRTVWR-476: Merge backout of 355d9db4a59f 2019-11-12 17:02:28 -05:00
Nat Goodspeed 369daed759 DRTVWR-476: Back out 355d9db4a59f: unroll stderr redirection. 2019-11-12 17:02:11 -05:00
Nat Goodspeed dbfd51b787 DRTVWR-476: Merge backout of e913c05d43b6 2019-11-12 16:59:23 -05:00
Nat Goodspeed 4c0a0712bb DRTVWR-476: Back out e913c05d43b6: unroll stderr redirection. 2019-11-12 16:59:08 -05:00
Nat Goodspeed d92ff30320 DRTVWR-476: Merge backout of e66ec842b851 2019-11-12 16:57:13 -05:00
Nat Goodspeed 814a7f14ad DRTVWR-476: Back out e66ec842b851: unrolling stderr redirection. 2019-11-12 16:56:43 -05:00
Nat Goodspeed bf33976b48 DRTVWR-476: Partially revert 978e09882565: undo using LLTempRedirect.
But leave LLTempRedirect available in the code base.
2019-11-12 16:54:56 -05:00
Nat Goodspeed 3e9d18671e DRTVWR-476: Don't test configuration.emptyMap().
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).
2019-11-12 14:47:13 -05:00
Nat Goodspeed c5303f1495 DRTVWR-476: Always clear both fields even if mOrigTarget invalid. 2019-11-12 14:43:19 -05:00
andreykproductengine f822ea6d29 Fix instance existance check
(transplanted from f4b79374f345ba7d4d34637f018eec5131b68f93)
2019-11-12 16:07:36 +02:00
AndreyL ProductEngine e96d0d5e30 Buildfix 2019-11-12 01:59:44 +02:00
AndreyL ProductEngine 84f3b2865f Merged in lindenlab/viewer-release 2019-11-12 00:39:07 +02:00
Nat Goodspeed 7ed993913c Automated merge with ssh://bitbucket.org/lindenlab/viewer-release 2019-11-11 16:45:37 -05:00
Nat Goodspeed 78bdf57ad6 increment viewer version to 6.3.5 2019-11-11 16:39:40 -05:00
Nat Goodspeed 55a5a2f0a7 Added tag 6.3.4-release for changeset 4033b3f57e76 2019-11-11 16:39:38 -05:00
Nat Goodspeed e7240167cd DRTVWR-476: Make viewer_manifest.py report its own command line.
That way, if there's a problem, a developer can rerun the same command.
2019-11-01 10:48:38 -04:00
Nat Goodspeed a935194750 DRTVWR-476, SL-12205: Refactor MSVC redist library copying.
Specify all of msvcp$VER.dll, msvcr$VER.dll and vcruntime$VER.dll -- but check
each of them individually, because any given VS release has only a subset of
those. Add messaging to clarify what we're doing.

Introduce to_staging_dirs CMake macro to cut down on redundant boilerplate:
the idiom in which we use copy_if_different twice, once to the Release staging
directory and once to the RelWithDebInfo staging directory, each time
appending the target pathnames to third_party_targets. Replace that idiom with
calls to to_staging_dirs.
2019-11-01 10:33:05 -04:00
Nat Goodspeed e74d61df81 DRTVWR-476: Annotate Mani's plea from 2009 with a suggested solution.
However, this is not the right moment to perform that refactoring.
2019-11-01 10:23:31 -04:00
Nat Goodspeed 1493210a40 DRTVWR-476, SL-12205: Search for msvcp140.dll, not msvcr140.dll
Evidently, with VS 2017, what would have been msvcr140.dll has become
vcruntime140.dll instead. msvcr140.dll is no longer a good sample DLL for
which to search.
2019-10-31 14:46:11 -04:00
Nat Goodspeed 4ab5e79cf4 DRTVWR-476, SL-12205: Update to glod built with VS 2017 runtime libs. 2019-10-31 13:54:51 -04:00
Nat Goodspeed 2a582e31ce DRTVWR-476: Encapsulate dup()/dup2() fd saving as LLTempRedirect. 2019-10-31 12:39:31 -04:00
Nat Goodspeed 8eae1fa7c9 DRTVWR-476: For VS 2017, MSVC_VERSION can be any of a range.
Thanks NickyD.
2019-10-31 09:22:07 -04:00
Nat Goodspeed e219468b8e DRTVWR-476: Throw some more Microsoft runtime DLLs at the viewer. 2019-10-31 09:14:43 -04:00