Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Apache::Session::FIle Locking Mechanism

by py_201 (Acolyte)
on Sep 17, 2009 at 04:48 UTC ( #795771=perlquestion: print w/ replies, xml ) Need Help??
py_201 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I have implemented Apache::Session::File for session management in my web application. For that we specify Directory and Lock Directory while tieing the session and what i have observed is that for each session_id, it creates one file named after session_id in the directory and two files in LockDirectory, out of which one is named after session_id and other one has some random number in its name.

what significance does these lock files have in session handling here?

Different requests to my web application(which can be concurrent also) alter session data in different ways. so sometimes session data gets lost in between those requests.

so my queries regarding sessions are:

What can i do to handle this data corruption? How Apache::Session::File handles concurrent access(for read,write) to session data.

Does Apache::Session::File provides some built in data locking mechanism. if yes, how does that work?

Any help would be appreciated.

Comment on Apache::Session::FIle Locking Mechanism
Re: Apache::Session::FIle Locking Mechanism
by Anonymous Monk on Sep 17, 2009 at 07:39 UTC
      its being stated there that Apache::Session::File provides locking with the help of files created in LockDirectory specified.My question is how they function internally . why does it create two files there.

      when we read or write some data in session , how do we get access to session file through these lock files

      why are two files created. what is their exact functionality in term of locking. what are all the things that i can do to prevent data corruption or loss between different requests.
      SORRY... lalit
Re: Apache::Session::FIle Locking Mechanism
by Anonymous Monk on Sep 17, 2009 at 15:26 UTC
    HI Py..

    Dude i have same prob. I am also trying to find out the solution of this. Infact, i got one solution for this, when u tie your application session, set Transaction attribute 1. I think this will definately help u. And in coming days, whenever u got something abt it, pls make me inform. My username is lalitbans on perlmonks and my email id is lbansal@gist.in. Hope this will help u.

    tie %session, 'Apache::Session::MySQL', $session_id, { DataSource => 'dbi:mysql:sessions', Transaction => '1', };
    Hope 2 c u soon.. Bye..

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://795771]
Approved by AnomalousMonk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-08-01 04:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (256 votes), past polls