From fdb23cb0e8d1b2173f0eb01d3058b72d7060ad10 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 15 Jul 2012 03:19:04 +0200 Subject: [PATCH] Crashfix/FIRE-4090/FIRE-4820: Always create LLVolatileAPRPool so it can be safely used from different threads. --- indra/llcommon/llapr.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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);