Search code examples
mysqlsqlsessionjoomla

Joomla 2.5 duplicate session error "PRIMARY' SQL=INSERT INTO"


This is the message we're receiving on the frontend

Duplicate entry '5dcf22giahsklj52uhukcdc6k5' for key 'PRIMARY' SQL=INSERT INTO `kawt1_session` (`session_id`, `client_id`, `time`) VALUES ('5dcf22giahsklj52uhukcdc6k5', 0, '1615520883')

I've tried truncating the sessions table, dropping the table and then creating a new structure with the following code

+++===============
    CREATE TABLE IF NOT EXISTS `kawt1_session` (
    `username` varchar(150) default '',
    `time` varchar(14) default '',
    `session_id` varchar(200) NOT NULL default '0',
    `guest` tinyint(4) default '1',
    `userid` int(11) default '0',
    `usertype` varchar(50) default '',
    `gid` tinyint(3) unsigned NOT NULL default '0',
    `client_id` tinyint(3) unsigned NOT NULL default '0',
    `data` longtext,
    PRIMARY KEY (`session_id`(64)),
    KEY `whosonline` (`guest`,`usertype`),
    KEY `userid` (`userid`),
    KEY `time` (`time`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    ===============+++

Solution

  • As I discovered the issue was ONLY displayed on the homepage of the website, I switched the default home page to another menu item. This resolved the problem. Now I have to understand why this only occurred on the home page.