• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Session gets destroyed

#1
[eluser]himself[/eluser]
Hi

My sessions keeps getting destroyed, e.g the user gets logged out.

I simply cannot figure out why.

Mysql data (which prob gets messed up now):
Code:
SELECT session_id, last_activity, length(user_data) FROM ci_sessions;
+----------------------------------+---------------+-------------------+
| session_id                       | last_activity | length(user_data) |
+----------------------------------+---------------+-------------------+
| 42fc1695a00dad0193ac7a6a2bfa72b1 |    1245307085 |               334 |
| 89911d917cd41556d223b5201c0d2974 |    1245307397 |               334 |
| ec1e444422ec19acff69c8d1386563f1 |    1245307397 |                 0 |
+----------------------------------+---------------+-------------------+

Th ip and user agent is not the problem, and the above should show that the cookie size (4kb) is not the problem.
My "ci-session-refresh-interval" is set at 300, so looking at the timestamp, it seems that it fails on the first attempt.

Normally the session works just fine, but not in this scenario:

I have a long list of images to be processed, there is not enough memory to process them all in one go, so i've made a form that, through javascript, submits itself, processes an image, submits itself, .... until its done.

From the sqldump you can se that it creates a new session_id.

From tampering a bit with the Session library, i can see that it's the session_id that (at some point) gets changed, so the session library creates a new on, meaning.. the user gets logged out.

Can anyone help point out where the problem could be, I know its a bit vague, but, hey... shoot :-)
Sincerely, Jonas

#2
[eluser]gtech[/eluser]
The sessionid is supposed to get regenerated after every 5 minutes (or 300 seconds), this is a security measure to make session hijacking more difficult. But I dont understand why that would log your user out? the session data is still there and you can still retrieve it, as a copy is made when the new id is generated.

Code:
// session data can still be retrieved after the sess_id has changed
$this->session->userdata('<variable name>');

maybee the session is expiring?, see sess_expiration in the config. this would cause the session to be destroyed.

#3
[eluser]TheFuzzy0ne[/eluser]
You don't have to process all of your images at the same time. You can just loop through each of them, reading them from the hard drive.

Is this just a random thing, or does it only happen when you run a certain controller, or a certain condition is met? What are the contents of the cookie? Is it encrypted? Do you still get the problem when you disable database sessions?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.