httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Chu <>
Subject apr_rmm, apr_anylock_t
Date Mon, 18 Jul 2005 20:40:06 GMT
Hi there,
   I've written an authorization module that uses cookies to track 
authorization state (for Apache 2.0.54). I'm using apr_shm to create a 
shared memory region to hold the state info (and just putting a session 
ID in the actual cookie). Using apr_rmm to manage the records seems to 
work OK, but my current code has a number of issues and I'm not sure 
where to look next.

I've created a apr_global_mutex_t to serialize access to the shared 
memory. It looks like I should have been able to use this apr_anylock_t 
but I haven't found any code examples of how to create/initialize one. 
It appears that apr_rmm protects itself with an anylock but none of the 
examples I've found ever pass one in to apr_rmm_init(). Also, while the 
apr_anylock_t appears to accomodate a variety of process/thread locks, 
it doesn't seem intended for use with a apr_global_mutex_t. Is that right?

It seems that I need to register a cleanup handler for this rmm region, 
but I don't know where or why. I just know that when I terminate the 
httpd process, "ipcs" shows a bunch of semaphores hanging around. If I 
start and stop httpd a few times (typical during a debugging session) 
the number of semaphores keeps growing and eventually httpd fails to 
startup because it can't allocate any more. I've already registered a 
cleanup handler for my global_mutex, but that didn't solve the problem.

I still have an unresolved question about what to do if someone changes 
the size of the shared memory cache in the config file and restarts the 
server. In my current code that change will just be ignored, unless you 
stop the server and delete the existing memory region first.

Any suggestions?
   -- Howard Chu
   Chief Architect, Symas Corp.
   Director, Highland Sun
   OpenLDAP Core Team  

View raw message