Bug#814980: Patch for bug #814980
I have patched my local Apache instance and found that after testing this in production since the last update I sent our hangs have disappeared.
The patch is as follows:
diff -Naur httpd-2.4.16\include\util_ldap.h httpd-2.4.16-ea\include\util_ldap.h
--- httpd-2.4.16\include\util_ldap.h Mon Jul 14 05:07:55 2014
+++ httpd-2.4.16-ea\include\util_ldap.h Mon Aug 29 10:20:08 2016
@@ -169,6 +169,10 @@
#if APR_HAS_SHARED_MEMORY
apr_shm_t *cache_shm;
apr_rmm_t *cache_rmm;
+#if APR_HAS_THREADS
+ apr_thread_mutex_t *lock;
+ apr_anylock_t cache_rmm_anylock;
+#endif
#endif
/* cache ald */
diff -Naur httpd-2.4.16\modules\ldap\util_ldap_cache.c httpd-2.4.16-ea\modules\ldap\util_ldap_cache.c
--- httpd-2.4.16\modules\ldap\util_ldap_cache.c Mon Aug 19 04:45:19 2013
+++ httpd-2.4.16-ea\modules\ldap\util_ldap_cache.c Mon Aug 29 10:23:04 2016
@@ -410,6 +410,14 @@
st->cache_shm = NULL;
return result;
}
+
+#if APR_HAS_THREADS
+ apr_thread_mutex_destroy(st->lock);
+ st->lock = NULL;
+ st->cache_rmm_anylock.type = apr_anylock_none;
+ st->cache_rmm_anylock.lock.pm = NULL;
+#endif
+
#endif
return APR_SUCCESS;
}
@@ -436,8 +444,18 @@
/* Determine the usable size of the shm segment. */
size = apr_shm_size_get(st->cache_shm);
+#if APR_HAS_THREADS
+ apr_thread_mutex_create(&st->lock, APR_THREAD_MUTEX_DEFAULT, st->pool);
+ st->cache_rmm_anylock.type = apr_anylock_threadmutex;
+ st->cache_rmm_anylock.lock.tm = st->lock;
+#else
+ st->lock = NULL;
+ st->cache_rmm_anylock.type = apr_anylock_none;
+ st->cache_rmm_anylock.lock.pm = NULL;
+#endif
+
/* This will create a rmm "handler" to get into the shared memory area */
- result = apr_rmm_init(&st->cache_rmm, NULL,
+ result = apr_rmm_init(&st->cache_rmm, &st->cache_rmm_anylock,
apr_shm_baseaddr_get(st->cache_shm), size,
st->pool);
if (result != APR_SUCCESS) {
Reply to: