Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Cache::Cache Stale Segments

Thread Tools

Cache::Cache Stale Segments

Jeff Nokes
Posts: n/a
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
Kind of like how Apache automatically removes its own shared memory

key shmid owner perms bytes nattch
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
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
TCP session on site-to-site gets stale professorguy Cisco 3 01-11-2007 01:17 PM
stale objects in collections Timo Nentwig Java 9 08-22-2006 03:16 PM
stale link error plz help Java 0 06-07-2006 05:28 AM
Wireless Connection goes stale? Wireless Networking 1 10-27-2005 04:02 PM
Stale Forms John Rivers ASP .Net 1 09-07-2005 03:45 PM