468,290 Members | 2,097 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,290 developers. It's quick & easy.

Cache::Cache Stale Segments

Hello,
I'm using Cache::SharedMemoryCache with an Apache 1.3.28 / mod_perl
1.28 / Mason instance on RedHat Linux 7.2. The caching mechanism
seems to work fine, it creates one shared memory segment and one
semophore when in use. What I noticed was that when I gracefully shut
apache down (completely), the segment and semaphore remain. I believe
this is mostly intentional from design, but I would like to be able to
remove any shared memory explicitly set by the application upon the
apache parent process shutdown, via an END{} block in my startup.pl.
Kind of like how Apache automatically removes its own shared memory
segment

ipcs:
key shmid owner perms bytes nattch
status
0x00000000 2326529 apache 600 46084 1 dest
I've tried using the built in methods from Cache::Cache (Clear(),
Purge(), remove()) to destroy the shared memory, but all it does is
wipe out the keys and their respective data, it doesn't get rid of the
actual segment/semaphore allocation in the OS. So, I've just been
resorting to using ipcrm manually after I shut apache down.

Since my keys stay the same for my shared data, Apache utilizes the
already allocated segment/semaphore upon restart, so there is no leak
issue. But the ops personnel who maintain the application don't like
having stale shared memory allocations hanging around once the
process(es) that is using them (apache) is shut down. Besides, by
design, the cache is cleared on startup and reloaded then anyway,
there's no business reason to keep the data there when there are no
processes accessing it.

Anyone have any suggestions on how I can take care of this
automatically during Apache's shutdown process? Or at least, how I
can get access to the shared mem id that Linux provides when the
memory is allocated? That way I could at least 'system()' out ipcrm
calls upon a graceful shutdown. Short of modifying the code in
Cache::Cache myself to meet my own needs, I'm not sure how to do any
of this.

Thanks in advance,
- Jeff
Jul 19 '05 #1
0 1355

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Charles Fineman | last post: by
reply views Thread by steve | last post: by
2 posts views Thread by Harry Simpson | last post: by
6 posts views Thread by Charts | last post: by
5 posts views Thread by Stan SR | last post: by
10 posts views Thread by hughestroop | last post: by
9 posts views Thread by Michael M. | last post: by
5 posts views Thread by =?iso-8859-1?B?TWF0dGlhcyBCcuRuZHN0cvZt?= | last post: by
vikas1111
3 posts views Thread by vikas1111 | last post: by
reply views Thread by NPC403 | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.