KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: clinton on October 27, 2009, 05:53:01 am

Title: Duplicate sessionId created
Post by: clinton on October 27, 2009, 05:53:01 am
Hi;
  we are getting several "Duplication sessionId created" warnings, generated from SecurityMgr.java:login:148, using konakart v3.2.0.0.

The full warning text is: " Duplicate sessionId created. We advise to clear out old sessions using the admin app since thi will affect performance."

Is the affect on performance the extra time required to recalculate and persist a sessionId, in the event of a duplicate? Or something more sinister?

I've checked our session table and we have 45,000 (!!!) sessions. What causes these sessions to accumulate and what can we do to reduce this build-up from occurring?  I know there's an admin function to remove old sessions, but I'm trying to understand the root cause, eg: is this a side effect of a Denial of Service attack?

-- Clinton
Title: Re: Duplicate sessionId created
Post by: trevor on October 27, 2009, 06:48:14 am
When a customer logs in, a session id is created and persisted in the database. If the new session id already exists in the database, then it is re-created until it no longer matches an existing one so that it can then be saved. This takes more time but it also means that the session table is full of expired sessions which will affect the overall performance since the session validity is checked on every API call and the session timeout parameter is updated. These select and update statements will take more time if the table is larger than it needs to be.

Sessions are only deleted when a customer logs out. What we recommend is to run a batch job every day that deletes (or archives) expired sessions in order to keep the table small.
Title: Re: Duplicate sessionId created
Post by: clinton on October 27, 2009, 11:41:22 pm
Interesting, thanks for the explanation.  Since we can't guarantee that users will hit the 'logout' button, this potentially affects every konakart installation. Over time, the SESSIONS table will grow with expired sessions, which will start to impact performance at a certain point. And storage.

I can't see a valid reason to keep expired sessions; the table contains a key, expiry date, value (customer id?) and store_id.  It's an unreliable indicator of customer activity, as the record is normally deleted if the customer officially logs out. It's only when a logout is not done that the record persists.

So as far as I can tell, expired sessions are useless and problematic and should be deleted?

Apart from running a batch script to delete them, some other ideas for automatic deletion are:



Anyway, the moral of the story seems to be: keep the SESSIONS table lean for optimal performance.

-- Clinton
Title: Re: Duplicate sessionId created
Post by: greg on October 28, 2009, 05:43:35 am
In our Enterprise Extensions there is an integration with quartz for job scheduling - we actually include a job to remove expired sessions in that.

Yes, as you quoted below, we advise that the sessions table is cleared out.

Title: Re: Duplicate sessionId created
Post by: Sony George on November 17, 2009, 10:56:06 am
Quote from: greg on October 28, 2009, 05:43:35 am
In our Enterprise Extensions there is an integration with quartz for job scheduling - we actually include a job to remove expired sessions in that.

Yes, as you quoted below, we advise that the sessions table is cleared out.


does this table "sessions"  have any relation to Cookie that is set by the app ??
ie: if "sessions" table data is deleted, then will it affect the Cookie values ??

regards
Title: Re: Duplicate sessionId created
Post by: greg on November 17, 2009, 11:16:10 am
you shouldn't empty the sessions table of every record there... only the expired ones.
Title: Re: Duplicate sessionId created
Post by: Sony George on November 17, 2009, 12:27:47 pm
Quote from: greg on November 17, 2009, 11:16:10 am
you shouldn't empty the sessions table of every record there... only the expired ones.


if the tomcat server is stopped , can i empty it ??
Title: Re: Duplicate sessionId created
Post by: greg on November 18, 2009, 06:01:27 am
Yes you can do that if you want to.