diff options
| author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-06-09 00:27:17 +0300 | 
|---|---|---|
| committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-06-09 00:30:19 +0300 | 
| commit | d358cca943f48a443e89630944383cb049ad9ef1 (patch) | |
| tree | 517f583d5b6abe9f54b1155784e62f245aefc0a0 | |
| parent | 3a16a54452eee72535e15a738c3678dc5671e24e (diff) | |
SL-15365 LLCoros::launch crash
Superficially looks like an out of memory crash, redirect allocation failures into LL_ERRS.
| -rw-r--r-- | indra/llcommon/llcoros.cpp | 27 | ||||
| -rw-r--r-- | indra/newview/llavatarrenderinfoaccountant.cpp | 2 | 
2 files changed, 21 insertions, 8 deletions
diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index 23419a52a7..e2ed0b0c16 100644 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -236,14 +236,25 @@ std::string LLCoros::launch(const std::string& prefix, const callable_t& callabl      // protected_fixedsize_stack sets a guard page past the end of the new      // stack so that stack underflow will result in an access violation      // instead of weird, subtle, possibly undiagnosed memory stomps. -    boost::fibers::fiber newCoro(boost::fibers::launch::dispatch, -                                 std::allocator_arg, -                                 boost::fibers::protected_fixedsize_stack(mStackSize), -                                 [this, &name, &callable](){ toplevel(name, callable); }); -    // You have two choices with a fiber instance: you can join() it or you -    // can detach() it. If you try to destroy the instance before doing -    // either, the program silently terminates. We don't need this handle. -    newCoro.detach(); + +    try +    { +        boost::fibers::fiber newCoro(boost::fibers::launch::dispatch, +            std::allocator_arg, +            boost::fibers::protected_fixedsize_stack(mStackSize), +            [this, &name, &callable]() { toplevel(name, callable); }); + +        // You have two choices with a fiber instance: you can join() it or you +        // can detach() it. If you try to destroy the instance before doing +        // either, the program silently terminates. We don't need this handle. +        newCoro.detach(); +    } +    catch (std::bad_alloc&) +    { +        // Out of memory on stack allocation? +        LL_ERRS("LLCoros") << "Bad memory allocation in LLCoros::launch(" << prefix << ")!" << LL_ENDL; +    } +      return name;  } diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index ca83afb5ab..04dbf03e31 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -345,6 +345,8 @@ void LLAvatarRenderInfoAccountant::idle()  				&& regionp->capabilitiesReceived())  			{  				// each of these is further governed by and resets its own timer +                // Note: We can have multiple regions, each launches up to two coroutines, +                // it likely is expensive  				sendRenderInfoToRegion(regionp);  				getRenderInfoFromRegion(regionp);  			}  | 
