Welcome Guest, Not a member yet? Register   Sign In
My users keep getting logged out randomly, WHILE using the app
#1

[eluser]antiver[/eluser]
Users are being logged out randomly within seconds of a recent activity.

Is something wrong with my configuration?

Code:
$config['sess_cookie_name']    = 'ci_session';
$config['sess_expiration']    = 604800;
$config['sess_encrypt_cookie']    = TRUE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']    = 'sessions';
$config['sess_match_ip']    = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']     = 300;

$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']        = "/";

And here's my DB schema:

Code:
CREATE TABLE IF NOT EXISTS `sessions` (
  `session_id` varchar(40) NOT NULL default '0',
  `ip_address` varchar(16) NOT NULL default '0',
  `user_agent` varchar(50) NOT NULL,
  `last_activity` int(10) unsigned NOT NULL default '0',
  `user_data` text NOT NULL,
  PRIMARY KEY  (`session_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Thanks. Let me know if I need to post something else relevant.
#2

[eluser]n0xie[/eluser]
Remove the underscore from your cookie name and see if you still have the same problem.
#3

[eluser]antiver[/eluser]
I set the following variable (was an empty string before):

Code:
$config['encryption_key']

And I'm now using following customized settings:

Code:
$config['sess_cookie_name']     = 'taggim';
$config['sess_expiration']      = 0;
$config['sess_encrypt_cookie']  = TRUE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']      = 'sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent'] = FALSE;
$config['sess_time_to_update']  = 60;

Code:
$config['cookie_prefix']        = "";
$config['cookie_domain']        = ".tagg.im";
$config['cookie_path']          = "/";

If the problem persists, I'll update this thread.
#4

[eluser]dannowatts[/eluser]
problem still persist?
#5

[eluser]antiver[/eluser]
The problem still persists; I didn't want to post again until I was confident.

The issue was not consistently reproducible until I identified the page most likely to produce the error.

As it turns out, the issue I'm seeing is a known bug in CodeIgniter that has been ignored for the past year: http://codeigniter.com/bug_tracker/bug/6600/

The issue is very easily reproducing by simply refreshing a single page VERY fast (I held CTRL+R in Firefox while using the Check4Change extension in another browser window to watch if I was logged in or out. By setting the sess_time_to_update variable very low (5 seconds) you can see the issue occur almost immediately.

I'm currently circumventing the issue by not using the database for sessions - a solution that is not acceptable in the long term for my application.
#6

[eluser]n0xie[/eluser]
Aah you failed to mention you were using AJAX. Next time please state your problem more clearly. This has been addressed:
Solution to session data loss when using AJAX
#7

[eluser]antiver[/eluser]
The solution you linked to fails to identify itself as a bandaid solution that does not solve the problem, but merely avoids it in a subset of circumstances.

The problem is NOT isolated to AJAX requests, and is NOT caused by AJAX requests.

Database-persisted sessions are curently broken within CI, period.
#8

[eluser]n0xie[/eluser]
I stand corrected. The parallel request is indeed what's causing the problem. I guess an extra check is needed to prevent this by saving the previous hash. You should be able to extend the Session class easily to fix it. Too bad Ellis Labs hasn't addressed this as of yet.
#9

[eluser]vendiddy[/eluser]
I am also having this issue. So frustrated! I can't seem to find a conclusive solution Sad




Theme © iAndrew 2016 - Forum software by © MyBB