XF 2.1 Deadlock found when trying to get lock

smozgur

Well-known member
This happens when certain users try to login - a few banned users.

It is related with xf_user_remember table. Here is the stack trace:

Stack trace​

DELETE FROM xf_user_remember WHERE user_id = ? AND expiry_date <= ?
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1213, '40001')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1213, '40001')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(289): XF\Db\AbstractAdapter->query('DELETE FROM `x...', Array)
#4 src/XF/Repository/UserRemember.php(105): XF\Db\AbstractAdapter->delete('xf_user_remembe...', 'user_id = ? AND...', Array)
#5 src/XF/Entity/UserRemember.php(89): XF\Repository\UserRemember->applyUserRememberRecordLimit(462180)
#6 src/XF/Mvc/Entity/Entity.php(1219): XF\Entity\UserRemember->_postSave()
#7 src/XF/Repository/UserRemember.php(15): XF\Mvc\Entity\Entity->save()
#8 src/XF/ControllerPlugin/Login.php(253): XF\Repository\UserRemember->createRememberRecord(462180)
#9 src/XF/ControllerPlugin/Login.php(190): XF\ControllerPlugin\Login->createVisitorRememberKey()
#10 src/XF/Pub/Controller/Login.php(117): XF\ControllerPlugin\Login->completeLogin(Object(XFRM\XF\Entity\User), true)
#11 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Login->actionLogin(Object(XF\Mvc\ParameterBag))
#12 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Login', 'Login', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Login), NULL)
#13 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Login), NULL)
#14 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#15 src/XF/App.php(2190): XF\Mvc\Dispatcher->run()
#16 src/XF.php(391): XF\App->run()
#17 index.php(20): XF::runApp('XF\\Pub\\App')
#18 {main}
I believe it is an automated login attempt causing the deadlock. Looks like it is trying to delete remember entry while it is also trying to use the same entry with another login attempt at the very same time.

I can see many entries for same users in xf_user_remember table. And yes, top records belong to the users who generate deadlock server error during the login.

It doesn't make sense having multiple entries for the same user in xf_user_remember table.

1596567641310.png

My question: Is that OK if I manually delete user associated entries in xf_user_remember? If not, what do you suggest?

Thanks.
 
Back
Top Bottom