You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Howard Chu <hy...@symas.com> on 2005/07/18 22:40:06 UTC
apr_rmm, apr_anylock_t
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. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc
OpenLDAP Core Team http://www.openldap.org/project/