Commit Graph

103 Commits (39a6735fc989bae16bbe77e56393e2f4ec076693)

Author SHA1 Message Date
Ansariel 39a6735fc9 Merge branch 'main' of https://github.com/secondlife/viewer
# Conflicts:
#	.gitignore
#	autobuild.xml
#	indra/cmake/APR.cmake
#	indra/newview/CMakeLists.txt
#	indra/newview/installers/windows/installer_template.nsi
#	indra/newview/viewer_manifest.py
#	indra/test/namedtempfile.h
2023-10-26 15:49:12 +02:00
Nat Goodspeed 6a219d147d SL-18837: Enlarge default coroutine stack size.
A test executable on a GitHub Windows runner failed with C00000FD, which
reports stack overflow.

(cherry picked from commit aab7b4ba3812e5876b1205285bcfd8cff96bcac9)
2023-08-31 21:11:11 -04:00
Ansariel 2b65ae8215 Merge branch 'DRTVWR-570-maint-Q' of https://bitbucket.org/lindenlab/viewer 2022-10-15 17:33:22 +02:00
Andrey Kleshchev 0160114256 Revert "Restored SL-14961"
This partially reverts commit 935c1362a2.
Reporting seems to have stoped working, trying the same way mac works.
2022-10-13 01:14:29 +03:00
Ansariel 2daf0cb2fd Merge branch 'master' of https://vcs.firestormviewer.org/phoenix-firestorm
# Conflicts:
#	indra/newview/app_settings/settings.xml
#	indra/newview/llfloatersearch.cpp
#	indra/newview/llgroupactions.cpp
#	indra/newview/llvovolume.cpp
2022-04-19 14:24:09 +02:00
Andrey Lihatskiy 026ad511ea Merge branch 'master' into DRTVWR-544-maint
# Conflicts:
#	indra/newview/app_settings/settings.xml
#	indra/newview/llfloatersearch.cpp
#	indra/newview/llgroupactions.cpp
#	indra/newview/llvovolume.cpp
2022-04-18 20:43:49 +03:00
Ansariel 63238d1fbe Merge branch 'DRTVWR-544-maint' of https://bitbucket.org/lindenlab/viewer
# Conflicts:
#	indra/cmake/Copy3rdPartyLibs.cmake
#	indra/cmake/FMODSTUDIO.cmake
#	indra/newview/llappviewer.cpp
#	indra/newview/llviewerregion.cpp
#	indra/newview/viewer_manifest.py
2022-03-01 19:19:48 +01:00
Andrey Kleshchev 935c1362a2 Restored SL-14961
SL-14961 works better for windows than rethrow
2022-02-14 22:59:26 +02:00
Nat Goodspeed 913bddf18f SL-10190: Slightly reduce conditional clutter in llcoros.{h,cpp}.
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-11 20:59:16 +02:00
Nat Goodspeed 6c3507d6d3 SL-10190: Introduce LLCoros::saveException() and rethrow().
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-11 20:53:21 +02:00
Andrey Kleshchev 236593e997 Revert "SL-14961 Coroutine crash was not reported to bugsplat"
Will be replaced with retrow from nat
2022-02-11 20:28:42 +02:00
Ansariel 1d9d378a9b Merge branch 'master' of https://vcs.firestormviewer.org/phoenix-firestorm 2021-11-19 09:08:43 +01:00
Andrey Lihatskiy 49dd88e86c Merge branch 'master' into DRTVWR-540-maint
# Conflicts:
#	indra/newview/llfloatereditextdaycycle.cpp
#	indra/newview/llviewerinput.cpp
2021-11-19 04:45:15 +02:00
Ansariel 603e04ee3c Merge branch 'DRTVWR-540-maint' of https://bitbucket.org/lindenlab/viewer 2021-08-24 13:18:55 +02:00
Ansariel 7ff7317779 Merge branch 'DRTVWR-521-maint' of https://bitbucket.org/lindenlab/viewer 2021-08-02 09:35:11 +02:00
Andrey Lihatskiy 6c8e6f033b Merge branch 'master' into DRTVWR-521-maint
# Conflicts:
#	autobuild.xml
#	indra/llcommon/llerror.cpp
#	indra/llui/llnotifications.h
#	indra/newview/llappviewer.cpp
#	indra/newview/llappviewermacosx.cpp
2021-07-20 02:48:05 +03:00
Andrey Kleshchev a6ea2dbedc SL-15292 Voice's singleton shutdown before voice's coroutine 2021-07-19 23:38:31 +03:00
Andrey Lihatskiy 3e85f6a8c9 Merge branch 'master' into DRTVWR-540-maint 2021-07-19 22:22:58 +03:00
Andrey Kleshchev d358cca943 SL-15365 LLCoros::launch crash
Superficially looks like an out of memory crash, redirect allocation failures into LL_ERRS.
2021-06-09 00:30:19 +03:00
Ansariel b1ba050b1f Merge branch 'DRTVWR-516-maint' of https://bitbucket.org/lindenlab/viewer 2021-04-30 23:29:58 +02:00
Ansariel 94534f4c88 Merge branch 'master' of https://vcs.firestormviewer.org/phoenix-firestorm 2021-04-30 23:25:06 +02:00
Ansariel db72dc7d0f Merge branch 'DRTVWR-516-maint' of https://bitbucket.org/lindenlab/viewer 2021-04-02 19:33:18 +02:00
Andrey Kleshchev ed98ebb811 SL-14961 Coroutine crash was not reported to bugsplat 2021-03-13 11:21:01 +02:00
Ansariel 6c587d437d Merge branch 'DRTVWR-515-maint' of https://bitbucket.org/lindenlab/viewer 2020-12-02 08:17:58 +01:00
Andrey Kleshchev bb4d02446f SL-14347 Crash at ChoosePixelFormat SEH 2020-12-01 18:22:24 +02:00
Nat Goodspeed 0756885ead DRTVWR-476: make printActiveCoroutines() output slightly clearer.
For the main coroutine on each thread, show the 'main0' (or whatever) name
instead of the empty-string name.
2020-03-25 19:25:42 -04:00
Nat Goodspeed 39e7b48317 DRTVWR-476: Make llcoro::logname() distinguish different threads.
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-25 19:24:25 -04:00
Nat Goodspeed 80f913fadb DRTVWR-476: Adjust LLCoros to new LLInstanceTracker API. 2020-03-25 19:24:25 -04:00
Nat Goodspeed 2a56ab4436 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.
2020-03-25 19:24:25 -04:00
Nat Goodspeed 9008124d35 DRTVWR-476: Keep coroutine-local data on toplevel()'s stack frame.
Instead of heap-allocating a CoroData instance per coroutine, storing the
pointer in a ptr_map and deleting it from the ptr_map once the
fiber_specific_ptr for that coroutine is cleaned up -- just declare a stack
instance on the top-level stack frame, the simplest C++ lifespan management.
Derive CoroData from LLInstanceTracker to detect potential name collisions and
to enumerate instances.

Continue registering each coroutine's CoroData instance in our
fiber_specific_ptr, but use a no-op deleter function.

Make ~LLCoros() directly pump the fiber scheduler a few times, instead of
having a special "LLApp" listener.
2020-03-25 19:05:16 -04:00
Nat Goodspeed 26c8ccfc06 DRTVWR-476: Back out changeset 40c0c6a8407d ("final" LLApp listener) 2020-03-25 19:02:24 -04:00
Nat Goodspeed cbf146f2b3 DRTVWR-476: Pump coroutines a few more times when we start quitting.
By the time "LLApp" listeners are notified that the app is quitting, the
mainloop is no longer running. Even though those listeners do things like
close work queues and inject exceptions into pending promises, any coroutines
waiting on those resources must regain control before they can notice and shut
down properly. Add a final "LLApp" listener that resumes ready coroutines a
few more times.

Make sure every other "LLApp" listener is positioned before that new one.
2020-03-25 19:02:24 -04:00
Nat Goodspeed 28a54c2f7b DRTVWR-476: Infrastructure to help manage long-lived coroutines.
Introduce LLCoros::Stop exception, with subclasses Stopping, Stopped and
Shutdown. Add LLCoros::checkStop(), intended to be called periodically by any
coroutine with nontrivial lifespan. It checks the LLApp status and, unless
isRunning(), throws one of these new exceptions.

Make LLCoros::toplevel() catch Stop specially and log forcible coroutine
termination.

Now that LLApp status matters even in a test program, introduce a trivial
LLTestApp subclass whose sole function is to make isRunning() true.
(LLApp::setStatus() is protected: only a subclass can call it.) Add LLTestApp
instances to lleventcoro_test.cpp and lllogin_test.cpp.

Make LLCoros::toplevel() accept parameters by value rather than by const
reference so we can continue using them even after context switches.

Make private LLCoros::get_CoroData() static. Given that we've observed some
coroutines living past LLCoros destruction, making the caller call
LLCoros::instance() is more dangerous than encapsulating it within a static
method -- since the encapsulated call can check LLCoros::wasDeleted() first
and do something reasonable instead. This also eliminates the need for both a
const and non-const overload.

Defend LLCoros::delete_CoroData() (cleanup function for fiber_specific_ptr for
CoroData, implicitly called after coroutine termination) against calls after
~LLCoros().

Add a status string to coroutine-local data, with LLCoro::setStatus(),
getStatus() and RAII class TempStatus.

Add an optional 'when' string argument to LLCoros::printActiveCoroutines().
Make ~LLCoros() print the coroutines still active at destruction.
2020-03-25 19:02:24 -04:00
Anchor 243b111565 [DRTVWR-476] - compile error fix 2020-03-25 18:39:20 -04:00
Nat Goodspeed 101ab28f0c SL-793: Fix lllogin_test.cpp for new LLCoros implementation.
Delete the test for SRV timeout: lllogin no longer issues an SRV query. That
test only confuses the test program without exercising any useful paths in
production code.

As with other tests dating from the previous LLCoros implementation, we need a
few llcoro::suspend() calls sprinkled in so that a fiber marked ready -- by
fulfilling the future for which it is waiting -- gets a chance to run.

Clear LLEventPumps between test functions.
2020-03-25 18:39:20 -04:00
Nat Goodspeed 66981fab0b SL-793: Use Boost.Fiber instead of the "dcoroutine" library.
Longtime fans will remember that the "dcoroutine" library is a Google Summer
of Code project by Giovanni P. Deretta. He originally called it
"Boost.Coroutine," and we originally added it to our 3p-boost autobuild
package as such. But when the official Boost.Coroutine library came along
(with a very different API), and we still needed the API of the GSoC project,
we renamed the unofficial one "dcoroutine" to allow coexistence.

The "dcoroutine" library had an internal low-level API more or less analogous
to Boost.Context. We later introduced an implementation of that internal API
based on Boost.Context, a step towards eliminating the GSoC code in favor of
official, supported Boost code.

However, recent versions of Boost.Context no longer support the API on which
we built the shim for "dcoroutine." We started down the path of reimplementing
that shim using the current Boost.Context API -- then realized that it's time
to bite the bullet and replace the "dcoroutine" API with the Boost.Fiber API,
which we've been itching to do for literally years now.

Naturally, most of the heavy lifting is in llcoros.{h,cpp} and
lleventcoro.{h,cpp} -- which is good: the LLCoros layer abstracts away most of
the differences between "dcoroutine" and Boost.Fiber.

The one feature Boost.Fiber does not provide is the ability to forcibly
terminate some other fiber. Accordingly, disable LLCoros::kill() and
LLCoprocedureManager::shutdown(). The only known shutdown() call was in
LLCoprocedurePool's destructor.

We also took the opportunity to remove postAndSuspend2() and its associated
machinery: FutureListener2, LLErrorEvent, errorException(), errorLog(),
LLCoroEventPumps. All that dual-LLEventPump stuff was introduced at a time
when the Responder pattern was king, and we assumed we'd want to listen on one
LLEventPump with the success handler and on another with the error handler. We
have never actually used that in practice. Remove associated tests, of course.

There is one other semantic difference that necessitates patching a number of
tests: with "dcoroutine," fulfilling a future IMMEDIATELY resumes the waiting
coroutine. With Boost.Fiber, fulfilling a future merely marks the fiber as
ready to resume next time the scheduler gets around to it. To observe the test
side effects, we've inserted a number of llcoro::suspend() calls -- also in
the main loop.

For a long time we retained a single unit test exercising the raw "dcoroutine"
API. Remove that.

Eliminate llcoro_get_id.{h,cpp}, which provided llcoro::get_id(), which was a
hack to emulate fiber-local variables. Since Boost.Fiber has an actual API for
that, remove the hack.

In fact, use (new alias) LLCoros::local_ptr for LLSingleton's dependency
tracking in place of llcoro::get_id().

In CMake land, replace BOOST_COROUTINE_LIBRARY with BOOST_FIBER_LIBRARY. We
don't actually use the Boost.Coroutine for anything (though there exist
plausible use cases).
2020-03-25 17:32:45 -04:00
Nicky Dasmijn a135b5b428 Merge remote-tracking branch 'origin/ll-vs2017' into fs-vs2017 2019-12-21 13:14:51 +01:00
Nicky Dasmijn 7f9bce5ada Merge branch 'master' into fs-vs2017 2019-12-21 01:52:19 +01:00
Nat Goodspeed be662c65ca DRTVWR-476: make printActiveCoroutines() output slightly clearer.
For the main coroutine on each thread, show the 'main0' (or whatever) name
instead of the empty-string name.
2019-12-18 15:54:00 -05:00
Nat Goodspeed aa9a8d6b44 Automated merge with ssh://bitbucket.org/lindenlab/viewer-vs2017 2019-12-13 13:32:20 -05:00
Nat Goodspeed 218c0a1d4f Automated merge with ssh://bitbucket.org/nat_linden/viewer-llsingleton 2019-12-13 13:20:21 -05:00
Nat Goodspeed 3abbd0b196 DRTVWR-476: Make llcoro::logname() distinguish different threads.
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.
2019-12-10 10:56:24 -05:00
Nicky 9335eded97 Merge with viewer-vs2107 2019-12-08 17:18:43 +01:00
Nat Goodspeed 622bbc7e39 DRTVWR-476: Adjust LLCoros to new LLInstanceTracker API. 2019-12-05 11:54:52 -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
Nicky fee98dac77 Merge with VS2017 2019-11-10 12:07:34 +01:00
Nat Goodspeed edd0ad6c79 DRTVWR-476: Keep coroutine-local data on toplevel()'s stack frame.
Instead of heap-allocating a CoroData instance per coroutine, storing the
pointer in a ptr_map and deleting it from the ptr_map once the
fiber_specific_ptr for that coroutine is cleaned up -- just declare a stack
instance on the top-level stack frame, the simplest C++ lifespan management.
Derive CoroData from LLInstanceTracker to detect potential name collisions and
to enumerate instances.

Continue registering each coroutine's CoroData instance in our
fiber_specific_ptr, but use a no-op deleter function.

Make ~LLCoros() directly pump the fiber scheduler a few times, instead of
having a special "LLApp" listener.
2019-10-25 06:55:45 -04:00
Nat Goodspeed 24d4f87afb DRTVWR-476: Back out changeset 40c0c6a8407d ("final" LLApp listener) 2019-10-24 16:05:37 -04:00
Nat Goodspeed 33c4170336 DRTVWR-476: Pump coroutines a few more times when we start quitting.
By the time "LLApp" listeners are notified that the app is quitting, the
mainloop is no longer running. Even though those listeners do things like
close work queues and inject exceptions into pending promises, any coroutines
waiting on those resources must regain control before they can notice and shut
down properly. Add a final "LLApp" listener that resumes ready coroutines a
few more times.

Make sure every other "LLApp" listener is positioned before that new one.
2019-10-24 12:54:38 -04:00
Nat Goodspeed 71ec081dbf DRTVWR-476: Infrastructure to help manage long-lived coroutines.
Introduce LLCoros::Stop exception, with subclasses Stopping, Stopped and
Shutdown. Add LLCoros::checkStop(), intended to be called periodically by any
coroutine with nontrivial lifespan. It checks the LLApp status and, unless
isRunning(), throws one of these new exceptions.

Make LLCoros::toplevel() catch Stop specially and log forcible coroutine
termination.

Now that LLApp status matters even in a test program, introduce a trivial
LLTestApp subclass whose sole function is to make isRunning() true.
(LLApp::setStatus() is protected: only a subclass can call it.) Add LLTestApp
instances to lleventcoro_test.cpp and lllogin_test.cpp.

Make LLCoros::toplevel() accept parameters by value rather than by const
reference so we can continue using them even after context switches.

Make private LLCoros::get_CoroData() static. Given that we've observed some
coroutines living past LLCoros destruction, making the caller call
LLCoros::instance() is more dangerous than encapsulating it within a static
method -- since the encapsulated call can check LLCoros::wasDeleted() first
and do something reasonable instead. This also eliminates the need for both a
const and non-const overload.

Defend LLCoros::delete_CoroData() (cleanup function for fiber_specific_ptr for
CoroData, implicitly called after coroutine termination) against calls after
~LLCoros().

Add a status string to coroutine-local data, with LLCoro::setStatus(),
getStatus() and RAII class TempStatus.

Add an optional 'when' string argument to LLCoros::printActiveCoroutines().
Make ~LLCoros() print the coroutines still active at destruction.
2019-10-22 16:49:29 -04:00