Server issue User merge doesn't merge users despite completing the action and showing success message

MilkyMeda

Active member
Affected version
2.1.3
No errors about this in the server log either. User merge takes long time in our site. We couldn't figure it out yet and now this started. IDK if it relates with 2.1.3.

While proccessing users, we get 1 or 2 erros but those aren't directly related to merge procces in my understanding:

Code:
XF\Db\Exception: MySQL query error [1205]: Lock wait timeout exceeded; try restarting transaction src/XF/Db/AbstractStatement.php:217
Ekleyen: xmartogo 30 Temmuz 2019 14:15
Yığın Takibi
            SELECT *
            FROM xf_thread
            WHERE thread_id = ?
            FOR UPDATE
       
------------

#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(145): XF\Db\AbstractAdapter->query('
            SELECT *
        ...', 734793)
#4 src/XF/Service/Thread/Replier.php(163): XF\Db\AbstractAdapter->fetchRow('
            SELECT *
        ...', 734793)
#5 src/addons/Snog/OSBrowser/XF/Service/Thread/Replier.php(13): XF\Service\Thread\Replier->_save()
#6 src/XF/Service/ValidateAndSavableTrait.php(40): Snog\OSBrowser\XF\Service\Thread\Replier->_save()
#7 src/XF/Pub/Controller/Thread.php(461): XF\Service\Thread\Replier->save()
#8 src/addons/KL/EditorManager/XF/Pub/Controller/Thread.php(23): XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#9 src/addons/KL/AutoMergeDoublePost/Pub/Controller/Thread.php(41): KL\EditorManager\XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#10 src/XF/Mvc/Dispatcher.php(321): KL\AutoMergeDoublePost\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#11 src/XF/Mvc/Dispatcher.php(244): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'AddReply', Object(XF\Mvc\RouteMatch), Object(Andy\SimilarThreads\XF\Pub\Controller\Thread), NULL)
#12 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Andy\SimilarThreads\XF\Pub\Controller\Thread), NULL)
#13 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#14 src/XF/App.php(2178): XF\Mvc\Dispatcher->run()
#15 src/XF.php(390): XF\App->run()
#16 index.php(20): XF::runApp('XF\\Pub\\App')
#17 {main}
 
This would really just fall under the banner of configuration and tuning. You can adjust the lock_wait_timeout in MySQL which may be required.
 
OK but if the process hasn't been completed yet, I shouldn't be getting success message.

I have a suggestion:

PHP:
$jobId = 'userMerge' . $target->user_id . '-' . $user->user_id;
$this->app->jobManager()->enqueueUnique($jobId, 'XF:UserMerge', [
   'sourceUserId' => $user->user_id,
   'targetUserId' => $target->user_id
]);

//If the enqueued job has completed without errors in one shot, this is fine:

return $this->redirect($this->buildLink('users/edit', $target, ['success' => true]));

//But if not, give me something like this: "The process is awaiting completion, you can continue to run it at tools/run-job."
 
Last edited:
Top Bottom