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

Fixed Template recompile error when disabling two add-ons in short succession

Jon W

Well-known member
#1
I just disabled (using the checkboxes on ACP homepage) two add-ons that both have template modifications for the footer template, and got the following error message:

Error Info
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate entry '590-style' for key 'PRIMARY' - library\Zend\Db\Statement\Mysqli.php:214
Generated By: Jonathan Wainwright, A moment ago

Stack Trace
#0 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\Zend\Db\Statement.php(317): Zend_Db_Statement_Mysqli->_execute(Array)
#1 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\Model\Template.php(1652): Zend_Db_Adapter_Abstract->query('???????INSERT I...')
#3 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\Deferred\TemplatePartialCompile.php(55): XenForo_Model_Template->compileAndInsertParsedTemplate(590, Array, 'footer', 1)
#4 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\Model\Deferred.php(190): XenForo_Deferred_TemplatePartialCompile->execute(Array, Array, 9.8444349765778, 'Rebuilding... T...')
#5 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\Model\Deferred.php(313): XenForo_Model_Deferred->runDeferred(Array, 9.8444349765778, 'Rebuilding... T...', false)
#6 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\Model\Deferred.php(266): XenForo_Model_Deferred->_runInternal(Array, 9.8444359302521, 'Rebuilding... T...', false)
#7 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\ViewRenderer\Abstract.php(344): XenForo_Model_Deferred->run(true, 9.8444359302521)
#8 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\ViewRenderer\Json.php(147): XenForo_ViewRenderer_Abstract::hasManualDeferredToRun()
#9 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\ViewRenderer\Json.php(181): XenForo_ViewRenderer_Json::_addDefaultParams(Array)
#10 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\ViewRenderer\Json.php(37): XenForo_ViewRenderer_Json::jsonEncodeForOutput(Array)
#11 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\FrontController.php(581): XenForo_ViewRenderer_Json->renderRedirect(4, 'http://localhos...', NULL, Array)
#12 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\FrontController.php(156): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_Redirect), Object(XenForo_ViewRenderer_Json), Array)
#13 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\admin.php(13): XenForo_FrontController->run()
#14 {main}
 
Last edited:

Jon W

Well-known member
#2
Just got a similar error when re-enabling several add-ons in short succession:

Error Info
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate entry '732-600' for key 'PRIMARY' - library\Zend\Db\Statement\Mysqli.php:214
Generated By: Jonathan Wainwright, 1 minute ago

Stack Trace
#0 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\Zend\Db\Statement.php(317): Zend_Db_Statement_Mysqli->_execute(Array)
#1 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\Model\Template.php(1624): Zend_Db_Adapter_Abstract->query('???????INSERT I...')
#3 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\Deferred\TemplatePartialCompile.php(55): XenForo_Model_Template->compileAndInsertParsedTemplate(732, Array, 'PAGE_CONTAINER', 1)
#4 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\Model\Deferred.php(190): XenForo_Deferred_TemplatePartialCompile->execute(Array, Array, 8.1349670886993, 'Rebuilding... T...')
#5 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\Model\Deferred.php(313): XenForo_Model_Deferred->runDeferred(Array, 8.1349670886993, 'Rebuilding... T...', false)
#6 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\Model\Deferred.php(266): XenForo_Model_Deferred->_runInternal(Array, 9.7668840885162, 'Rebuilding... T...', false)
#7 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\ViewRenderer\Abstract.php(344): XenForo_Model_Deferred->run(true, 9.7668840885162)
#8 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\ViewRenderer\Json.php(147): XenForo_ViewRenderer_Abstract::hasManualDeferredToRun()
#9 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\ViewRenderer\Json.php(181): XenForo_ViewRenderer_Json::_addDefaultParams(Array)
#10 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\ViewRenderer\Json.php(37): XenForo_ViewRenderer_Json::jsonEncodeForOutput(Array)
#11 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\FrontController.php(581): XenForo_ViewRenderer_Json->renderRedirect(4, 'http://localhos...', NULL, Array)
#12 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\library\XenForo\FrontController.php(156): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_Redirect), Object(XenForo_ViewRenderer_Json), Array)
#13 C:\Program Files (x86)\Zend\Apache2\htdocs\beta4\admin.php(13): XenForo_FrontController->run()
#14 {main}

Slightly different error, but essentially the same problem.
 

Mike

XenForo developer
Staff member
#3
I'm not 100% sure why these queries were triggering problems. As far as I know, the deletes/transactions should've prevented it. You don't happen to be using MyISAM tables do you?

Regardless, I've changed these queries so they shouldn't cause an error.
 

Jon W

Well-known member
#5
Just got a deadlock error in RC1:

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: Jonathan Wainwright, 1 minute ago

Stack Trace
#0 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\Zend\Db\Statement.php(317): Zend_Db_Statement_Mysqli->_execute(Array)
#1 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\Zend\Db\Adapter\Abstract.php(661): Zend_Db_Adapter_Abstract->query('DELETE FROM `xf...')
#3 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\XenForo\Model\Template.php(1644): Zend_Db_Adapter_Abstract->delete('xf_template_phr...', 'template_map_id...')
#4 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\XenForo\Deferred\TemplatePartialCompile.php(55): XenForo_Model_Template->compileAndInsertParsedTemplate(1209, Array, 'PAGE_CONTAINER', 1)
#5 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\XenForo\Model\Deferred.php(197): XenForo_Deferred_TemplatePartialCompile->execute(Array, Array, 9.5303900241852, 'Rebuilding... T...')
#6 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\XenForo\Model\Deferred.php(320): XenForo_Model_Deferred->runDeferred(Array, 9.5303900241852, 'Rebuilding... T...', false)
#7 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\XenForo\Model\Deferred.php(273): XenForo_Model_Deferred->_runInternal(Array, 9.5303959846497, 'Rebuilding... T...', false)
#8 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\XenForo\ViewRenderer\Abstract.php(352): XenForo_Model_Deferred->run(true, 9.5303959846497)
#9 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\XenForo\ViewRenderer\Json.php(147): XenForo_ViewRenderer_Abstract::hasManualDeferredToRun()
#10 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\XenForo\ViewRenderer\Json.php(181): XenForo_ViewRenderer_Json::_addDefaultParams(Array)
#11 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\XenForo\ViewRenderer\Json.php(37): XenForo_ViewRenderer_Json::jsonEncodeForOutput(Array)
#12 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\XenForo\FrontController.php(583): XenForo_ViewRenderer_Json->renderRedirect(4, 'http://localhos...', NULL, Array)
#13 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\library\XenForo\FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_Redirect), Object(XenForo_ViewRenderer_Json), Array)
#14 C:\Program Files (x86)\Zend\Apache2\htdocs\xenforo\admin.php(13): XenForo_FrontController->run()
#15 {main}
 

Mike

XenForo developer
Staff member
#7
Deadlocks can happen though they should be very rare. In general they're not easy to completely prevent though and they're hard to handle programmatically. A refresh/retry of the action is usually sufficient.