httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tair-Shian Chou" <tair-shian.c...@hp.com>
Subject RE: util_ldap [Bug 29217] - Remove references to calloc()and free()
Date Sat, 12 Jun 2004 01:37:35 GMT
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


Mime
View raw message