Welcome Guest, Not a member yet? Register   Sign In
Database sessions and garbage collection

Ok, I finally found what the problem is.
PHP had session.gc_probability set to 0. Don't know really how that happened, maybe the latest php5 package from Ubuntu modified it, as I made apt-get upgrade about 2 weeks ago and php5 was also inside.

System: Ubuntu Server 14.04.2
PHP 5.5.9-1ubuntu4.6

Here's more info about PHP's session garbage collection in case somebody needs it.
Quote:session.gc_probability in conjunction with session.gc_divisor is used to manage probability that the gc (garbage collection) routine is started. Defaults to 1

Quote:session.gc_divisor coupled with session.gc_probability defines the probability that the gc (garbage collection) process is started on every session initialization. The probability is calculated by using gc_probability/gc_divisor, e.g. 1/100 means there is a 1% chance that the GC process starts on each request. session.gc_divisor defaults to 100.
Source: http://php.net/manual/en/session.configu...robability

mwhitney thanks for your suggestion, but I really think that the method i'm using to find online users is more appropriate.
As of the maintenance of the `user_id` field I'm doing the following on user login:

PHP Code:
       // delete user's old sessions
       $this->db->delete('sessions', array(
           'user_id' => $id

       // fill `sessions`.`user_id` of the new one
           ->update('sessions', array(
               'user_id' => $uid

Messages In This Thread
RE: Database sessions and garbage collection - by kozzleto - 03-09-2015, 01:02 PM

Theme © iAndrew 2016 - Forum software by © MyBB