Jump to content

Sessions table not emptied


Blesta Addons

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 .

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 months later...
  • Tyson locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...