diff options
| author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-09-15 01:22:27 +0300 | 
|---|---|---|
| committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-09-15 20:33:55 +0300 | 
| commit | 37246b99f698f53194c3d60b471e190af79a45fe (patch) | |
| tree | c053f940d7f5c713067e60459fb8bfb01a74031e /indra/llcommon | |
| parent | 2b96b06669df6ba4be88b8645127b7b9d09632ed (diff) | |
SL-17135 Apr process creation crash
looks like pool regularly gets corrupted, try using separate pool
Diffstat (limited to 'indra/llcommon')
| -rw-r--r-- | indra/llcommon/llapr.cpp | 8 | ||||
| -rw-r--r-- | indra/llcommon/llprocess.cpp | 19 | ||||
| -rw-r--r-- | indra/llcommon/llprocess.h | 1 | 
3 files changed, 24 insertions, 4 deletions
| diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index 435531f86f..69466df2d1 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -38,6 +38,12 @@ const S32 FULL_VOLATILE_APR_POOL = 1024 ; //number of references to LLVolatileAP  bool gAPRInitialized = false; +int abortfunc(int retcode) +{ +    LL_WARNS("APR") << "Allocation failure in apr pool with code " << (S32)retcode << LL_ENDL; +    return 0; +} +  void ll_init_apr()  {  	// Initialize APR and create the global pool @@ -45,7 +51,7 @@ void ll_init_apr()  	if (!gAPRPoolp)  	{ -		apr_pool_create(&gAPRPoolp, NULL); +		apr_pool_create_ex(&gAPRPoolp, NULL, abortfunc, NULL);  	}  	if(!LLAPRFile::sAPRFilePoolp) diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 97a38ea992..0d65762284 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -529,6 +529,7 @@ LLProcess::LLProcess(const LLSDOrParams& params):  	// preserve existing semantics, we promise that mAttached defaults to the  	// same setting as mAutokill.  	mAttached(params.attached.isProvided()? params.attached : params.autokill), +    mPool(NULL),  	mPipes(NSLOTS)  {  	// Hmm, when you construct a ptr_vector with a size, it merely reserves @@ -549,8 +550,14 @@ LLProcess::LLProcess(const LLSDOrParams& params):  	mPostend = params.postend; +    apr_pool_create(&mPool, gAPRPoolp); +    if (!mPool) +    { +        LLTHROW(LLProcessError(STRINGIZE("failed to create apr pool"))); +    } +  	apr_procattr_t *procattr = NULL; -	chkapr(apr_procattr_create(&procattr, gAPRPoolp)); +	chkapr(apr_procattr_create(&procattr, mPool));  	// IQA-490, CHOP-900: On Windows, ask APR to jump through hoops to  	// constrain the set of handles passed to the child process. Before we @@ -689,14 +696,14 @@ LLProcess::LLProcess(const LLSDOrParams& params):  	// one. Hand-expand chkapr() macro so we can fill in the actual command  	// string instead of the variable names.  	if (ll_apr_warn_status(apr_proc_create(&mProcess, argv[0], &argv[0], NULL, procattr, -										   gAPRPoolp))) +										   mPool)))  	{  		LLTHROW(LLProcessError(STRINGIZE(params << " failed")));  	}  	// arrange to call status_callback()  	apr_proc_other_child_register(&mProcess, &LLProcess::status_callback, this, mProcess.in, -								  gAPRPoolp); +                                  mPool);  	// and make sure we poll it once per "mainloop" tick  	sProcessListener.addPoll(*this);  	mStatus.mState = RUNNING; @@ -815,6 +822,12 @@ LLProcess::~LLProcess()  	{  		kill("destructor");  	} + +    if (mPool) +    { +        apr_pool_destroy(mPool); +        mPool = NULL; +    }  }  bool LLProcess::kill(const std::string& who) diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index e3386ad88e..0842f2eb07 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -568,6 +568,7 @@ private:  	// explicitly want this ptr_vector to be able to store NULLs  	typedef boost::ptr_vector< boost::nullable<BasePipe> > PipeVector;  	PipeVector mPipes; +    apr_pool_t* mPool;  };  /// for logging | 
