title: Codeigniter sessions die
body: <p>After a little bit of use (25min - 1.5 hour) in my system, users experience a kick. For some reason my sessions are kind of dyeing. I think that the cookie on the client side somehow loses the session ID and creates  a new one. I am saving my session data on <code>Database</code>.</p>
  
  <p>This is my session conf:</p>
  
  <pre><code>        $config['sess_cookie_name']     = 'v2Session';
          $config['sess_expiration']      = 32400; //session will be 9 hours, for a shift.
          $config['sess_expire_on_close'] = FALSE;
          $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'] = TRUE;
          $config['sess_time_to_update']  = 300;
  </code></pre>
  
  <p>Now, when I look in the DB I see multiple sessions for each user. Each kick means a new session and the old session is not deleted until it expires. When the session "detaches" the users need to login again. </p>
  
  <p>Any help troubleshooting this will be appreciated.</p>
  
  <p>EDIT:</p>
  
  <p>So after some research I have noticed that the sessions die because the <code>session_id</code> that is saved in the <code>cookie</code> and the <code>session_id</code> that is saved in the <code>database</code> do not match. I suspect that this happens when the user loads 2 pages each on a different tab/window. One load happens just when the session updates the <code>session_id</code> and the second load (which kills the session) with the old <code>session_id</code>. The system looks for the session in the <code>database</code> and doesn't find it. <strong>Result:</strong> Kick from the system + mad user.</p>
  
  <p>Has anybody experienced this? and does anyone have an idea on how to fix this? </p>