Session errors with persistent sessions
When using MySQL to store persistent sessions, under small load we can have these errors:
[Mon Apr 25 12:06:10.828219 2016] [perl:debug] [pid 11166] CGI.pm(115): Lemonldap::NG::Portal::SharedConf: Session cannot be tied: DBD::mysql::st execute failed: Duplicate entry 'fffd45c5af0defda3df59fdd3b392c12' for key 'PRIMARY' at /usr/share/perl5/Apache/Session/Browseable/Store/DBI.pm line 37.\n
[Mon Apr 25 12:06:10.864856 2016] [perl:error] [pid 11166] Session cannot be tied: DBD::mysql::st execute failed: Duplicate entry 'fffd45c5af0defda3df59fdd3b392c12' for key 'PRIMARY' at /usr/share/perl5/Apache/Session/Browseable/Store/DBI.pm line 37.\n
{code}
This occurs because the session backend module tries to do an 'INSERT INTO' instead of an 'UPDATE':
{code}
25 Query INSERT INTO psessions (id,a_session,_session_uid) VALUES ('fffd45c5af0defda3df59fdd3b392c12','^E\n^C\0\0\0^A\n fffd45c5af0defda3df59fdd3b392c12\0\0\0^K_session_id',NULL
I tried to look into our Common::Session code but I don't see why this occurs.
Any help would be appreciated.