XF 1.4 Server error Duplicate entry for key 'expiry_date' and site not accessible

Renegade

Well-known member
Server Error
Mysqli statement execute error : Duplicate entry '1409840687' for key 'expiry_date'

  1. Zend_Db_Statement_Mysqli->_execute() in Zend/Db/Statement.php at line 297
  2. Zend_Db_Statement->execute() in Zend/Db/Adapter/Abstract.php at line 479
  3. Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 574
  4. Zend_Db_Adapter_Abstract->insert() in XenForo/Session.php at line 814
  5. XenForo_Session->saveSessionToSource() in XenForo/Session.php at line 532
  6. XenForo_Session->save() in XenForo/Controller.php at line 412
  7. XenForo_Controller->updateSession() in XenForo/Controller.php at line 356
  8. XenForo_Controller->postDispatch() in XenForo/FrontController.php at line 354
  9. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134

How to resolve?
 
What changes have you made to the site? You have a unique index where there shouldn't be one. It shouldn't just appear automatically though.
 
You can recreate xf_session table:
Code:
CREATE TABLE xf_session (
        session_id VARBINARY(32) NOT NULL,
        session_data MEDIUMBLOB NOT NULL,
        expiry_date INT UNSIGNED NOT NULL,
        PRIMARY KEY (session_id),
        KEY expiry_date (expiry_date)
    ) ENGINE = MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
But it would be important to figure out why it got changed.
 
The last change I made was day before when I upgraded to RC2 and then upgraded an add-on. This has been appearing since last one hour on its own.
 
Ok I repaired the tables and the site is working again.

On login I found this in the error logs. This is now the third time xf_session.MYI has had problem in the last one year. Thats why I thought I should first try repairing the tables even before I saw this error log.

Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Incorrect key file for table './dbxf/xf_session.MYI'; try to repair it - library/Zend/Db/Statement/Mysqli.php:214
Generated By: Unknown Account, 4 minutes ago
Stack Trace
#0 /home/et/public_html/community/library/Zend/Db/Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /home/et/public_html/community/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/et/public_html/community/library/Zend/Db/Adapter/Abstract.php(574): Zend_Db_Adapter_Abstract->query('INSERT INTO `xf...', Array)
#3 /home/et/public_html/community/library/XenForo/Session.php(814): Zend_Db_Adapter_Abstract->insert('xf_session', Array)
#4 /home/et/public_html/community/library/XenForo/Session.php(532): XenForo_Session->saveSessionToSource('17af68e62005b47...', false)
#5 /home/et/public_html/community/library/XenForo/Controller.php(412): XenForo_Session->save()
#6 /home/et/public_html/community/library/XenForo/Controller.php(356): XenForo_Controller->updateSession(Object(XenForo_ControllerResponse_View), 'XenForo_Control...', 'Index')
#7 /home/et/public_html/community/library/XenForo/FrontController.php(354): XenForo_Controller->postDispatch(Object(XenForo_ControllerResponse_View), 'XenForo_Control...', 'Index')
#8 /home/et/public_html/community/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /home/et/public_html/community/index.php(13): XenForo_FrontController->run()
#10 {main}
Request State
array(3) {
["url"] => string(76) "https://com/community/threads/need-suggestions.8091/"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 
Top Bottom