You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Tair-Shian Chou <ta...@hp.com> on 2004/06/12 03:37:35 UTC
RE: util_ldap [Bug 29217] - Remove references to calloc()and free()
Brad Nicholes wrote:
>
> In fact, I don't think that these are shared locks at all
>
> #define LDAP_CACHE_LOCK_CREATE(p) \
> if (!st->util_ldap_cache_lock)
> apr_thread_rwlock_create(&st->util_ldap_cache_lock, st->pool)
>
> which means that in the shared memory cache, it is highly
> likely that multiple processes could be altering the cache at
> the same time. True?
> Since NetWare is multi-threaded only, we never see this problem.
>
This is true. This creates a process-wide mutex, which can only synchronize
threads within the same process so multiple processes can alternate the ldap
cache at the same time. This was causing segmentation fault on HP-UX. We
have fixed this by creating a global mutex lock in util_ldap_cache_init();
if (!st->util_ldap_cache_lock) {
lock_file = apr_psprintf(pool,"%s.lock",st->cache_file);
result =
apr_global_mutex_create(&st->util_ldap_cache_lock,lock_file,APR_LOCK_PROC_PT
HREAD,pool);
if (result != APR_SUCCESS) {
return result;
}
We used mutex instead of rwlock because there is no apr* function to create
a global rwlock.
This change fixed the segmentation fault problem.
Chou