Welcome Guest, Not a member yet? Register   Sign In
Session logout problems
#20

[eluser]Dan Allen[/eluser]
We solved by working with session configuration variables in two places. No code changes were needed.

Spotting the configuration problem was complicated by my my misunderstanding of how variables in the application/libraries do not necessarily (maybe never) override variables in the application/config. I am still not 100% understanding, but I think we fixed with the settings below.

We traced the problem inside the application/libraries/Session/sess_update()

Code:
if (($this->userdata['last_activity'] + $this->sess_time_to_update) >= $this->now)
        {
            log_message('debug', "Session update NO");
            return;
        }
        log_message('debug', "Session update YES");
        ...
The CI log (and ci_session table) showed the session update was not happening, leading to expiration of the session.

The action of deleting the session records from the DB may have been caused by a combination of too much time on $sess_time_to_update leading to deletion of the record by the garbage collection function. The apparent random occurrence of the logging out would be explained by the random function controlling the frequency of when the garbage collection function is executed.

The specific settings we run for the moment are below. I am sure the $sess_time_to_update could be increased significantly while $sess_expiration could be decreased. We had ours mixed up, so these settings are ultra liberal on not logging people out or nailing them with inadvertent garbage collection.

SETTINGS THAT APPEAR TO WORK

Code:
//application/libraries/Session.php
//---------------------------------
    var $sess_expiration            = 10800;
    var $sess_time_to_update        = 30;
    var $gc_probability             = 5;  // causes garbage collection to run 5% of the time,
                                          // at random intervals


//application/config/config.php
//----------------------------
    var $sess_expiration      = 10800;
    var $sess_time_to_update      = 30;
    var $gc_probability              = 5;



SETTINGS THAT DID NOT WORK

Code:
//application/libraries/Session.php
//---------------------------------
    var $sess_expiration            = 7200;
    var $sess_time_to_update        = 300;
    var $gc_probability             = 5;


//application/config/config.php
//----------------------------
    var $sess_expiration     = 0;
    var $sess_time_to_update     = 1500;
Hope this helps someone down the line.

In the meantime, CI rocks. What else can I say?

Best regards,
Dan




Messages In This Thread
Session logout problems - by El Forum - 05-13-2009, 03:42 PM
Session logout problems - by El Forum - 05-13-2009, 04:22 PM
Session logout problems - by El Forum - 05-13-2009, 07:07 PM
Session logout problems - by El Forum - 05-13-2009, 07:31 PM
Session logout problems - by El Forum - 05-13-2009, 07:41 PM
Session logout problems - by El Forum - 05-14-2009, 01:42 AM
Session logout problems - by El Forum - 05-14-2009, 01:49 AM
Session logout problems - by El Forum - 05-14-2009, 11:27 AM
Session logout problems - by El Forum - 05-15-2009, 06:21 AM
Session logout problems - by El Forum - 05-15-2009, 06:23 AM
Session logout problems - by El Forum - 05-15-2009, 06:31 AM
Session logout problems - by El Forum - 05-15-2009, 07:54 AM
Session logout problems - by El Forum - 05-15-2009, 07:59 AM
Session logout problems - by El Forum - 05-15-2009, 08:00 AM
Session logout problems - by El Forum - 05-15-2009, 08:34 AM
Session logout problems - by El Forum - 05-15-2009, 08:46 AM
Session logout problems - by El Forum - 05-18-2009, 08:04 AM
Session logout problems - by El Forum - 01-12-2011, 12:04 AM
Session logout problems - by El Forum - 02-08-2012, 12:56 PM
Session logout problems - by El Forum - 02-10-2012, 12:19 PM
Session logout problems - by El Forum - 02-15-2012, 07:42 AM
Session logout problems - by El Forum - 02-15-2012, 12:33 PM
Session logout problems - by El Forum - 02-15-2012, 12:35 PM
Session logout problems - by El Forum - 02-15-2012, 12:38 PM
Session logout problems - by El Forum - 02-18-2012, 06:33 PM



Theme © iAndrew 2016 - Forum software by © MyBB