lost sessions in plain CI 2.1.4 install |
[eluser]mlieshout[/eluser]
Hi, I know this has been asked many, many times on this forum, but I keep losing sessions in a CI 2.1.4 website. The sessions gets destroyed in Session.php, when the session data getting back from $this->_unserialize($session) is no longer in the correct format. To make sure it's not caused by the code I wrote, I've ran the same tests in a plain CI 2.1.4 download with these settings: $config['sess_cookie_name'] = 'cisession'; $config['sess_expiration'] = 7200; $config['sess_expire_on_close'] = TRUE; $config['sess_encrypt_cookie'] = TRUE; $config['sess_use_database'] = TRUE; $config['sess_table_name'] = 'ci_sessions'; $config['sess_match_ip'] = TRUE; $config['sess_match_useragent']= FALSE; $config['sess_time_to_update'] = 300; $config['cookie_prefix'] = ""; $config['cookie_domain'] = ".ci2"; $config['cookie_path'] = "/"; $config['cookie_secure'] = FALSE; $config['global_xss_filtering'] = TRUE; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; CREATE TABLE `ci_sessions` ( `session_id` varchar(40) NOT NULL DEFAULT '0', `ip_address` varchar(45) NOT NULL DEFAULT '0', `user_agent` varchar(120) NOT NULL, `last_activity` int(10) unsigned NOT NULL DEFAULT '0', `user_data` text NOT NULL, PRIMARY KEY (`session_id`), KEY `last_activity_idx` (`last_activity`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; The test is done with jMeter and simulates a number of 100 Threads (users). All it does is a GET on the index.php. It gives lots of dropped sessions. I've searched the forum, tried several solutions (like base64_encode/base64_decode in the _unserialize() and _serialize() functions) but it keeps loosing sessions. So, I'm kind of stuck. Anyone knows a working solution for this problem?
[eluser]Doosje[/eluser]
Have you found a solution? I happens here too but not all the btw.
[eluser]mlieshout[/eluser]
I've upgraded the web app to the CI 3.0-development trunk. There is no way you can fix this in CI 2.1.4
[eluser]Doosje[/eluser]
huh, no way to fix it? Do you know where the problem is located? Or is it the "not native" session handling? thx for your quick answer btw;-)
[eluser]mlieshout[/eluser]
I believe the problem is located in the Session library in CI 2.x. I've spent way to many hours on this problem, so upgrading to CI 3.0 was the best option for me. The sessions are far more stable than in CI 2.x. Just give it a try
[eluser]Doosje[/eluser]
here's a solution for those who can't update atm. https://degreesofzero.com/article/fixing...niter.html
[eluser]InsiteFX[/eluser]
You don't autoload MY_Session you autoload the Session library it will find the MY_Session Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
Welcome Guest, Not a member yet? Register Sign In |