XF 1.2 MySQL Deadlock

Brent W

Well-known member
On one of our forums I am having to do a lot of reorganizing. Every time I run the Batch Thread update I end up with one error like this:

Error Info
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Deadlock found when trying to get lock; try restarting transaction - library/Zend/Db/Statement/Mysqli.php:214
Generated By: Unknown Account, 7 minutes ago
Stack Trace
#0 /home/mus37/public_html/library/Zend/Db/Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /home/mus37/public_html/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/mus37/public_html/library/XenForo/Model/DataRegistry.php(164): Zend_Db_Adapter_Abstract->query('?????INSERT INT...', Array)
#3 /home/mus37/public_html/library/XenForo/Model/Deferred.php(150): XenForo_Model_DataRegistry->set('deferredRun', 1380753030)
#4 /home/mus37/public_html/library/XenForo/Model/Deferred.php(119): XenForo_Model_Deferred->updateNextDeferredTime()
#5 /home/mus37/public_html/library/XenForo/Application.php(1288): XenForo_Model_Deferred->defer('Cron', Array, 'cron', false, 1380753097)
#6 /home/mus37/public_html/library/XenForo/Deferred/Cron.php(12): XenForo_Application::defer('Cron', Array, 'cron', false, 1380753097)
#7 /home/mus37/public_html/library/XenForo/Model/Deferred.php(208): XenForo_Deferred_Cron->execute(Array, Array, 4.17693519592, 'Search Index (P...')
#8 /home/mus37/public_html/library/XenForo/Model/Deferred.php(331): XenForo_Model_Deferred->runDeferred(Array, 4.17693519592, 'Search Index (P...', false)
#9 /home/mus37/public_html/library/XenForo/Model/Deferred.php(284): XenForo_Model_Deferred->_runInternal(Array, NULL, 'Search Index (P...', false)
#10 /home/mus37/public_html/deferred.php(18): XenForo_Model_Deferred->run(false)
#11 {main}
Request State
array(3) {
  ["url"] => string(34) "http://3.7mustang.com/deferred.php"
  ["_GET"] => array(0) {
  ["_POST"] => array(3) {
    ["_xfRequestUri"] => string(39) "/threads/orgasalarm-ww-language.236760/"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"


XenForo developer
Staff member
Deadlocks can happen and a refresh is usually enough to fix it. However, I'm not seeing why it's happening here. I think the transactions are quite short and consistent so it shouldn't happen?

Can you paste the full output of this query?
Is this seemingly happening every time you run the batch update? Or is it less consistent than that?