• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Got the following error logged

imthebest

Well-known member
#1
Code:
Error Info
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate entry '260604' for key 'PRIMARY' - library/Zend/Db/Statement/Mysqli.php:214
Generated By: Moderator, Yesterday, 22:15
Stack Trace

#0 /var/www/html/library/Zend/Db/Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /var/www/html/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /var/www/html/library/Zend/Db/Adapter/Abstract.php(574): Zend_Db_Adapter_Abstract->query('INSERT INTO `xf...', Array)
#3 /var/www/html/library/XenForo/DataWriter.php(1624): Zend_Db_Adapter_Abstract->insert('xf_user_ban', Array)
#4 /var/www/html/library/XenForo/DataWriter.php(1613): XenForo_DataWriter->_insert()
#5 /var/www/html/library/XenForo/DataWriter.php(1405): XenForo_DataWriter->_save()
#6 /var/www/html/library/XenForo/Model/User.php(2612): XenForo_DataWriter->save()
#7 /var/www/html/library/XenForo/Model/SpamCleaner.php(159): XenForo_Model_User->ban(260604, 0, 'Spam', false, NULL)
#8 /var/www/html/library/XenForo/Model/SpamCleaner.php(27): XenForo_Model_SpamCleaner->_banUser(Array, Array, NULL)
#9 /var/www/html/library/XenForo/ControllerPublic/SpamCleaner.php(53): XenForo_Model_SpamCleaner->cleanUp(Array, Array, Array, NULL)
#10 /var/www/html/library/XenForo/FrontController.php(347): XenForo_ControllerPublic_SpamCleaner->actionIndex()
#11 /var/www/html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#12 /var/www/html/index.php(13): XenForo_FrontController->run()
#13 {main}

Request State

array(3) {
  ["url"] => string(58) "http://www.mysite.com/spam-cleaner/random-member.260604/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(11) {
    ["action_threads"] => string(1) "1"
    ["delete_messages"] => string(1) "1"
    ["delete_conversations"] => string(1) "1"
    ["ban_user"] => string(1) "1"
    ["check_ips"] => string(1) "1"
    ["noredirect"] => string(1) "0"
    ["_xfToken"] => string(8) "********"
    ["_xfConfirm"] => string(1) "1"
    ["_xfRequestUri"] => string(56) "/threads/a-thread-of-2014.683508/page-5"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 

Jake Bunce

XenForo moderator
Staff member
#2
@Super120

That error means you are banning the user (via spam cleaner) but the user has already been banned. You should be able to fix this by unbanning him before cleaning him again:

Admin CP -> Users -> Banned Users

This is likely a race condition where two moderators are cleaning the same user at the same time. I have seen this once before:

https://xenforo.com/community/threads/spam-spam-and-more-spame.35595/page-2#post-406300

I am moving this to bug reports in case the devs want to address it. For example, an ON DUPLICATE KEY query might be an option here.
 

imthebest

Well-known member
#3
I might be wrong but it appears that regardless the error the spam cleaner did its job (the posts were deleted).

Anyway the devs should take in consideration your ON DUPLICATE KEY suggestion.