perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tracy12 <j_lal...@yahoo.com>
Subject Re: Session handling
Date Fri, 18 Apr 2008 00:12:58 GMT

We do run a cron job to clean up the cache,  Anyhow even it contains old
data, they are basically expired, I can't
understand how that gonna cause this issue, To my understanding we clean up
the cache primarily because it is just filling up the hard disk,

Other thing is I did not mention any cache file sie as such pls see the
following code,  In my Authentication handler overall what it does is once
authenticated it does put the validated user in the session and try to use
that value thereafter for subsequent requests.

Following I extracted from my Auth hanlder to hightlight the places I do use
the CGI:Session commands, Other mod_perl statements are left out

# TMP_SESSION_FOLDER is the local folder to hold cookies defined else where
my $session = new CGI::Session() or die CGI::Session->errstr;

#as the new command looks after the expired cookies and also the existence,
no any if conditions done but following #executes in each request

$session = new CGI::Session(undef, undef, {Directory=>
$TMP_SESSION_FOLDER});
# expire the session and also the remote_user_for_library parameter
#SESSION_TIME_OUT is the timeout value(30m) and SESSION_USER_PARAM is the
parameter name for authenticated user

$session->expire($SESSION_TIME_OUT);
$session->expire($SESSION_USER_PARAM, $SESSION_TIME_OUT);

 # retrieve remote_user from the session
        $retrieved_user = $session->param($SESSION_USER_PARAM);

#if retrieved_user is not empty this is users subsequent request

If it is the first time access it validates the user and put it to the
session as follows.
$user carries the value of the authenticated user

 $session->param($SESSION_USER_PARAM, $user);

Here the issue is eventhough the session timeout is 30m, 
 $session->param($SESSION_USER_PARAM, $user); return empty string before the
30m


Hope this information is enough for some one to make a comment



Malcolm J Harwood-3 wrote:
> 
> On Thursday 17 April 2008 01:04:14 Tracy12 wrote:
> 
>> for session handling we use CGI:Session cpan distribution,
>>
>> we do use local file for cookie storage, eventhough the session time out
>> is
>> 30, sometimes the set information in the
>> session get lost before that, has anybody experience this before.
> 
> That sounds like you are using a cache file and your cache is filling up. 
> 
>> We do have a cron job to clear the session data, Is there any solution
>> for
>> this behavior? What exactly the possible reason for such a thing.
> 
> The nature of a cache is that it will drop older data to make room for
> newer. 
> So your solutions are to make a larger cache file (you may have to
> experiment 
> to work out what size you need), or to switch to some other session
> storage 
> mechanism that has different properties.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Session-handling-tp16738934p16758221.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


Mime
View raw message