httpd version: current/trunk (2.2?)
Platform: win xp pro SP2

I built Apache, added
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
...
LDAPSharedCacheFile "c:\ldap.cache"

and this causes crash on exit. The crash happends at util_ldap_cache_mgr.c:
util_ald_destroy_cache(). It attempts to free() a node with some
garbage address.
After some investigation I noticed that address of cache->nodes
changes between process start and process ends.

To make long story short:
st->cache is allocated in shared memory.
cache->nodes is also allocated in shared memory.
Let's say parent process creates cache and nodes. Then parent executes
cache->nodes = ShmAllocate(...);

The child process starts. It attach to shared memory and do the same,
allocate and, attention:
cache->nodes = ShmAllocate(...);

But as soon as this memory is shared, addres cache->nodes for child is
different from parent. So child overrites parents cache->nodes!

Then, on exit parent attempts to release an address that is
meaningless in its process space.

Another thing I don't like too much is that both, parent and children
will call apr_shm_destroy()
I think correct way to do it would be children call detach() and only
parent calls destroy()

BTW: could comebody explain, how modules configs are shared between
processes? Is an instance created by each process? Main process shares
them with children via shared memory?

Vadim Chekan.

Reply via email to