XF 2.2 Many MySQL query error [1205] after upgrade 2.2.2 to 2.2.3

Azaly

Active member
After last XenForo upgrade I got many MySQL errors:
XF\Db\Exception: MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction src/XF/Db/AbstractStatement.php:228
I do not see any changes in server load and there are no any busy process in background in time I get an error in XenForo log.
Code:
UPDATE  `xf_forum` SET `message_count` = ?, `last_post_date` = ?, `last_post_id` = ?, `last_post_user_id` = ?, `last_post_username` = ?, `last_thread_id` = ?, `last_thread_title` = ? WHERE `node_id` = 39
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1205, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1205, 'HY000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(322): XF\Db\AbstractAdapter->query('UPDATE  `xf_for...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1515): XF\Db\AbstractAdapter->update('xf_forum', Array, '`node_id` = 39')
#5 src/XF/Mvc/Entity/Entity.php(1242): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Entity/Thread.php(1365): XF\Mvc\Entity\Entity->save()
#7 src/XF/Entity/Thread.php(1169): XF\Entity\Thread->updateForumRecord()
#8 src/XF/Mvc/Entity/Entity.php(1266): XF\Entity\Thread->_postSave()
#9 src/XF/Entity/Post.php(624): XF\Mvc\Entity\Entity->save()
#10 src/XF/Entity/Post.php(582): XF\Entity\Post->updateThreadRecord()
#11 src/XF/Mvc/Entity/Entity.php(1266): XF\Entity\Post->_postSave()
#12 src/XF/Service/Thread/Replier.php(209): XF\Mvc\Entity\Entity->save(true, false)
#13 src/XF/Service/ValidateAndSavableTrait.php(40): XF\Service\Thread\Replier->_save()
#14 src/XF/Pub/Controller/Thread.php(603): XF\Service\Thread\Replier->save()
#15 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#16 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'AddReply', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Thread), NULL)
#17 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Thread), NULL)
#18 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#19 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#20 src/XF.php(488): XF\App->run()
#21 index.php(20): XF::runApp('XF\\Pub\\App')
#22 {main}

Code:
UPDATE  `xf_user` SET `alerts_unviewed` = ?, `alerts_unread` = ? WHERE `user_id` = 28796
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1205, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1205, 'HY000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(322): XF\Db\AbstractAdapter->query('UPDATE  `xf_use...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1515): XF\Db\AbstractAdapter->update('xf_user', Array, '`user_id` = 287...')
#5 src/XF/Mvc/Entity/Entity.php(1242): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Repository/UserAlert.php(489): XF\Mvc\Entity\Entity->save(true, false)
#7 src/XF/Db/AbstractAdapter.php(455): XF\Repository\UserAlert->XF\Repository\{closure}(Object(XF\Db\Mysqli\Adapter))
#8 src/XF/Repository/UserAlert.php(490): XF\Db\AbstractAdapter->executeTransaction(Object(Closure), 1)
#9 src/XF/Pub/Controller/Thread.php(125): XF\Repository\UserAlert->markUserAlertsReadForContent('post', Array)
#10 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Thread->actionIndex(Object(XF\Mvc\ParameterBag))
#11 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'Index', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Thread), NULL)
#12 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Thread), NULL)
#13 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#14 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#15 src/XF.php(488): XF\App->run()
#16 index.php(20): XF::runApp('XF\\Pub\\App')
#17 {main}

Code:
            UPDATE xf_user
            SET reaction_score = reaction_score + ?
            WHERE user_id = ?
    
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1205, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1205, 'HY000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Entity/ReactionContent.php(192): XF\Db\AbstractAdapter->query('
            UPDATE xf_u...', Array)
#4 src/XF/Entity/ReactionContent.php(115): XF\Entity\ReactionContent->adjustUserReactionScore(625, 1)
#5 src/XF/Mvc/Entity/Entity.php(1266): XF\Entity\ReactionContent->_postSave()
#6 src/XF/Repository/Reaction.php(189): XF\Mvc\Entity\Entity->save()
#7 src/XF/Repository/Reaction.php(142): XF\Repository\Reaction->insertReaction(1, 'post', 4262171, Object(SV\WarningImprovements\XF\Entity\User), true, false)
#8 src/XF/ControllerPlugin/Reaction.php(65): XF\Repository\Reaction->reactToContent(1, 'post', 4262171, Object(SV\WarningImprovements\XF\Entity\User), true)
#9 src/XF/ControllerPlugin/Reaction.php(19): XF\ControllerPlugin\Reaction->actionToggleReaction(Object(XF\Entity\Post), 'posts/reactions', 'posts')
#10 src/XF/ControllerPlugin/Reaction.php(12): XF\ControllerPlugin\Reaction->actionReact(Object(XF\Entity\Post), 'posts', 'posts/react', 'posts/reactions')
#11 src/XF/Pub/Controller/Post.php(381): XF\ControllerPlugin\Reaction->actionReactSimple(Object(XF\Entity\Post), 'posts')
#12 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Post->actionReact(Object(XF\Mvc\ParameterBag))
#13 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Post', 'React', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Post), NULL)
#14 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Post), NULL)
#15 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#16 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#17 src/XF.php(488): XF\App->run()
#18 index.php(20): XF::runApp('XF\\Pub\\App')
#19 {main}
 
Last edited:
This happens only in threads with 10K+ posts. If I try to merge 2 posts in such treads it took 3 min (in small threads and before upgrading it tooks 1 sec).
I've tried rebuild threads via cmd (because I changes some tags nearly in same time as upgrading), but this didn't help.
 
Back
Top Bottom