Pavel Šmejkal wrote:
Hello, I am trying to improve mod_vhost_dbi module.
Off topic for this list, but I am the author of this module, and if you
are interested, I am willing to give commit access to it or get your
patches into the 'official' version.
I added some new
features like better PHP support and caching with apr_hash. Everything
works fine but i have little problem with function apr_hash_get. I have
structure vhost_cache_entry which i created and fill. there is stored
informations about virtual host. After this i store this structure to
hash table. In next request is this information retrieved from hash
table instead of database. But some times function apr_hash_get returns
damaged structure with string like "\xf06\xc5" in document_root
property. I can find any thing wrong in my code. In next request is
everything ok. Is there somebody which can helps me please.
At a guess, I would guess the cache structure or some of the fields are
being allocated out of a per-request pool, and that pool gets cleared
before the next request.
// CREATE CACHE_ENTRY
cache_entry = (vhost_cache_entry *) apr_pcalloc(r->pool,
sizeof(vhost_cache_entry));
Yep, you shouldn't use r->pool for this. The lifetime for r->pool is
just for this request, consider using r->server->process->pool.
-Paul