You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by cbell <cb...@lighthouseasp.com> on 2000/11/29 19:03:17 UTC

Apache Session and Lock files

Hi everyone,

After tying a hash variable to a session, and writing to it, I would
like to undef my hash variable just to make sure that the session lock
file is deleted.  However, when I do this, then any changes I make to
the session hash don't get saved.  If I don't undef the session hash,
then the session data remains but I end up eventually with lots of lock
files in my tmp directory.

Has anyone run across this and come up with a solution.  I set Commit =
1 on my Tie command, and I commit changes to my database, but the data
still disappears if I undefine the hash.

Thanks in advance...


Re: Apache Session and Lock files

Posted by Perrin Harkins <pe...@primenet.com>.
On Wed, 29 Nov 2000, cbell wrote:
> After tying a hash variable to a session, and writing to it, I would
> like to undef my hash variable just to make sure that the session lock
> file is deleted.  However, when I do this, then any changes I make to
> the session hash don't get saved.

Well, yeah.  When you undef it, you destroy the session.  You don't even
have a hash to write to anymore.  It will save what you had, but you'll
have to go and open it again if you want to use it.  You shouldn't need to
do this anyway, since I think Apache::Session does an immediate save when
you create a new session.

Whay are you worried about the lock files?  Have you had a problem with
them lingering?

Incidentally, if you're using a database for storage you don't need to do
additional locking.  Just use NullLocker. 

- Perrin