0 users online. Create an account or sign in to join them.Users

Search

I have a (rather big) website which evolved since Symphony 2 beta revision 4. Today I noticed that there are around 400.000 rows in the database. 380.000 of them are in the "sym_sessions" table.

Shouldn't those sessions be deleted after a while? Is this something that has been solved in between? And what is the best way to clean up the database?

The number of rows in the sym_sessions table has exceeded 1.5 million (causing significant backup costs for the database alone).

Can anybody help me?

We discovered this bug that was introduced by Marcin a little while ago - took us a while to figure out but there's a simple fix to it (which Alistair will point out).

There is a fix. I spent awhile trying to solve the problem, as we too were getting stupidly high numbers of sessions. The problem was to do with line 145 of /core/class.session.php

return self::$_db->query('DELETE FROM `sym_sessions` WHERE `session_expires` = '.$fields['session_expires']);

Notice the = sign in the SQL statement. This is in a function for garbage collection, and the = means that only old sessions with an expiry of exactly $fields['session_expires'] will get removed. It should be a < or <=.

The fix is already in the integration branch, but if you're on an older version, feel free to update your copy of class.session.php. Hoping that fixes the problem.

Alistair, thank you very much for your help on this! (The website in question is on Symphony 2.0.2, but applying the modified line from /core/class.session.php worked perfectly.)

Alistair, any idea when the next merge of integration into master will be? This way I know whether to apply this fix now or just wait a few days until the merge...

If you have less than 1.5 million lines in your sessions table, there's no need to hurry. :-) My website didn't suffer from this amount of data.

Good to know.

Alistair, any idea when the next merge of integration into master will be?

Shortly after we have the new Symphony site launched, we will be releasing another incremental update (2.0.3 I guess).

Allen, Alistair sorry for that bug (looks like it was there from the very beginning? :(.

All good mate, you should try counting the number of times Alistair introduced a bug!

Your contribution far outweighs the bug potential. At any rate, as the system evolves, bugs are always expected :)

OT @Allen: Is there a time you are sleeping? Or are you some kind of robot living in this forum?!

Allen, maybe so, but still it was my bug which made You guys waste a lot of time, not the other way around :).

Counting bugs could be a pissing contest for geeks… only it could make things worse, as soon as people would start introducing bugs intentionally - just to win the race ;).

@ahwayakchih: I would agree with Allen:

Your contribution far outweighs the bug potential.

michael-e, i owe You apology too… i remember You reported this before, but i was sure it was caused by something else (one of defined variables) and focused on fixing that instead. Sorry for that.

Anyone still having problems with a massive session table, have a look at this http://getsymphony.com/discuss/issues/view/104/ and let us know if it helps.

I am not sure if it has been asked before but: Why don’t you simply use the $_SESSION-array the way it’s supposed to be?

the way it’s supposed to be?

Not sure what you mean. Using custom functions for the session handling is totally legitimate.

I mean you can save everything you want in it. Like $_SESSION['username'] = "phoque";

So why the need for a table when all you do is save a serialized array anyways?

Alistair, your patch doesn’t seem to work on 2.0.7. I get:

Access to undeclared static property: Symphony::$Log in /Users/me/Sites/dev/www.example.com/symphony/lib/core/class.session.php on line 140

[EDIT]: I only get this error message every few page loads.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details