Blesta Addons Posted March 29, 2018 Report Posted March 29, 2018 today i have noticed that the table sessions is not cleared from 2017-07-20 .i don't think this is a normal behavior or intentional usage . today we have more than 1 million sessions records !!!!
Tyson Posted March 29, 2018 Report Posted March 29, 2018 What are the configured values for your session TTL and cookie TTL in your /config/blesta.php? php's garbage collector will only look at removing session data older than those values, and it has a small probability to run, so it's possible records that old are still kept based on your Blesta TTLs and the php server's configuration for garbage collection.
Blesta Addons Posted March 29, 2018 Author Report Posted March 29, 2018 1 hour ago, Tyson said: What are the configured values for your session TTL and cookie TTL in your /config/blesta.php? php's garbage collector will only look at removing session data older than those values, and it has a small probability to run, so it's possible records that old are still kept based on your Blesta TTLs and the php server's configuration for garbage collection. Configure::set('Blesta.session_ttl', 1800); // 30 minutes Configure::set('Blesta.cookie_ttl', 604800); // 7 days maybe this happen after we upgraded to v 4.0.0
Tyson Posted March 29, 2018 Report Posted March 29, 2018 What about php's configured garbage collection settings? It is odd that you have so many records that haven't been purged by now. My dev installation only has a couple weeks of session information.
Blesta Addons Posted March 30, 2018 Author Report Posted March 30, 2018 10 hours ago, Tyson said: What about php's configured garbage collection settings? It is odd that you have so many records that haven't been purged by now. My dev installation only has a couple weeks of session information. session.gc_maxlifetime 1440 all other settings was well filled, this issue as only after upgrading to v4 that is sure .
Tyson Posted March 30, 2018 Report Posted March 30, 2018 Blesta overrides the session.gc_maxlifetime value, but how often the garbage collector runs is determined by the session.gc_probability and session.gc_divisor. I checked other Blesta installations from v4.0 to v4.3 and the garbage collector is running for all of them, so it might be that garbage collection is disabled in your environment?
Blesta Addons Posted March 31, 2018 Author Report Posted March 31, 2018 17 hours ago, Tyson said: Blesta overrides the session.gc_maxlifetime value, but how often the garbage collector runs is determined by the session.gc_probability and session.gc_divisor. I checked other Blesta installations from v4.0 to v4.3 and the garbage collector is running for all of them, so it might be that garbage collection is disabled in your environment? from my end, i have in my other test server sessions that are from 2017-09-19 !!! this test installation are not in the same server as the production, it has it own server . the commune things between them Cpanel as control panel PHP 5.6 MYSQL 5.6.38 session.gc_probability = 0 session.gc_divisor = 0
Blesta Addons Posted March 31, 2018 Author Report Posted March 31, 2018 i will change this values to and watch session.gc_probability = 1 session.gc_divisor = 100
Blesta Addons Posted April 2, 2018 Author Report Posted April 2, 2018 after 2 days, the sessions table was not emptied . i have checked the sessions directory and i found a reasonable files, and all of them has date of march 2018 (last month). the sessions table in Blesta database is not emptied for some reasons !!! i don't know why Blesta is not handling this . should i empty the table manually?
Tyson Posted April 2, 2018 Report Posted April 2, 2018 On 3/31/2018 at 5:56 AM, Blesta Addons said: from my end, i have in my other test server sessions that are from 2017-09-19 !!! this test installation are not in the same server as the production, it has it own server . the commune things between them Cpanel as control panel PHP 5.6 MYSQL 5.6.38 session.gc_probability = 0 session.gc_divisor = 0 If those session values, session.gc_probability and session.gc_divisor were set to 0, then the session's garbage collector was disabled which explains the large amount of old sessions in the system. On 3/31/2018 at 5:59 AM, Blesta Addons said: i will change this values to and watch session.gc_probability = 1 session.gc_divisor = 100 Did you update all of your Blesta servers to ensure they have these values set? Those are php's default values, which give the garbage collector a 1% chance of running when someone connects, so that sounds good. 6 hours ago, Blesta Addons said: after 2 days, the sessions table was not emptied . i have checked the sessions directory and i found a reasonable files, and all of them has date of march 2018 (last month). the sessions table in Blesta database is not emptied for some reasons !!! i don't know why Blesta is not handling this . should i empty the table manually? No, I don't think you should empty the table manually unless you are out of disk space and need to clean something up. It would be best to observe that the php garbage collector clears the old session data on its own. Since it was only a couple days since you updated those php settings , the garbage collector may not have actually run yet since it only has a 1% chance to based on user activity. I would give it some more time to see whether it eventually deletes those old records by itself. You could also increase the probability of it running the garbage collector, e.g., set session.gc_probability to 100 to force the garbage collector to run 100% of the time. It should then clear the old session records, however, you should change the session.gc_probability back to 1 afterward.
Tyson Posted June 22, 2018 Report Posted June 22, 2018 Did the garbage collector ever run to purge your old session data or do you think this is still an issue with Blesta?
Blesta Addons Posted June 23, 2018 Author Report Posted June 23, 2018 14 hours ago, Tyson said: Did the garbage collector ever run to purge your old session data or do you think this is still an issue with Blesta? it was resolved by editing the value of the above config in php.ini session.gc_probability = 1 session.gc_divisor = 100 Tyson and Paul 2
Recommended Posts