diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index c0ca69f42d..8ab7f5bcea 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -158,7 +158,17 @@ LLVolatileAPRPool::LLVolatileAPRPool(BOOL is_local, apr_pool_t *parent, apr_size mMutexp(NULL) { //create mutex - if(!is_local) //not a local apr_pool, that is: shared by multiple threads. + + // Crashfix/FIRE-4090/FIRE-4820: is_local is default to TRUE. And of today (2012-07-15) all instances of LLVolatileAPRPool seem + // to be created just using this default argument. + // Using apr_os_thread_current and apr_os_thread_equal it appears that there are pools that get access from different threads nonetheless. + // This would explain why mNumActiveRef sometimes gets garbled. + // Resolution: Always use a mutex and give it a broader test is this helps. + + // if(!is_local) //not a local apr_pool, that is: shared by multiple threads. + + // + { apr_pool_create(&mMutexPool, NULL); // Create a pool for mutex apr_thread_mutex_create(&mMutexp, APR_THREAD_MUTEX_UNNESTED, mMutexPool);