XF 2.2 When a user is deleted, does Xenforo run a job to recalculate reaction scores?

Stuart Wright

Well-known member
When a user is deleted, does Xenforo run a job to recalculate reaction scores, removing scores given by and received from the deleted user?
I ask because usually, when we delete users, our HUGE servers run out of memory and the job halts. I usually have to press the Delete user button 2 or 3 times to get the process to complete.
We're trying to track down the cause.

I have the slow query logger report this information when deleting a member earlier:
  • Exception: Slow query: 7.6138 seconds, /job.php
  • src/addons/SV/SlowQueryLogger/Db/Mysqli/SlowQueryLogAdapter.php:387
  • Generated by: Unknown account
  • Oct 28, 2022 at 12:23 PM

Stack trace​

#0 src/XF/Db/Mysqli/Statement.php(110): SV\SlowQueryLogger\Db\Mysqli\SlowQueryLogAdapter->logQueryCompletion()
#1 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#2 src/XF/Reaction/AbstractHandler.php(147): XF\Db\AbstractAdapter->query('
UPDATE (
...', Array)
#3 src/XF/Service/User/ContentChange.php(351): XF\Reaction\AbstractHandler->updateRecentCacheForUserChange(310920, 0, 'iceboy', 'iceboy')
#4 src/XF/MultiPartRunnerTrait.php(48): XF\Service\User\ContentChange->stepRebuildReactions(2, 7.4589)
#5 src/XF/Service/User/ContentChange.php(206): XF\Service\User\ContentChange->runLoop(7.55786)
#6 src/XF/Service/User/DeleteCleanUp.php(310): XF\Service\User\ContentChange->apply(7.55786)
#7 src/XF/MultiPartRunnerTrait.php(48): XF\Service\User\DeleteCleanUp->stepChangeOwner(NULL, 7.55786)
#8 src/XF/Service/User/DeleteCleanUp.php(96): XF\Service\User\DeleteCleanUp->runLoop(7.62888)
#9 src/XF/Job/UserDeleteCleanUp.php(34): XF\Service\User\DeleteCleanUp->cleanUp(7.62888)
#10 src/XF/Job/Manager.php(260): XF\Job\UserDeleteCleanUp->run(7.62888)
#11 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 7.62888)
#12 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 7.62888)
#13 job.php(43): XF\Job\Manager->runQueue(false, 8)
#14 {main}

Request state​

array(4) {
["url"] => string(8) "/job.php"
["referrer"] => string(59) "https://www.avforums.com/admin.php?users/iceboy.310920/edit"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}

A more recent user deletion is taking ages to recalculate the reaction scores. Maybe that's the cause?
1.webp
 
In fact just to clarify - the above trace was for a merge of the quoted account into another; not a simple delete per se.

The screenshot below refers to a different case altogether; that was a delete.

I don't recall seeing the recalculation text in the earlier merge; it certainly didn't hang for 15 minutes while it did it as did the later deletion.
 
Yup, deleting a user is expensive time-wise as XF locks the entire table while it does a non-chunked update to change the user id/username bits. It is easy for 3rd party add-ons to add tables to that system which may be unexpectedly complex for process it.

I know are using my Content Rating add-on but it isn't actually involved in the delete user process like that. It might be another add-on which is doing post-delete cleanup.
 
Last edited:
Yup, deleting a user is expensive time-wise as XF locks the entire table while it does a non-chunked update to change the user id/username bits. It is easy for 3rd party add-ons to add tables to that system which may be unexpectedly complex for process it.

I know are using my Content Rating add-on but it isn't actually involved in the delete user process like that. It might be another add-on which is doing post-delete cleanup.
Unfortunately we are getting lots of GDPR requests from members to delete their accounts, which also requires a name change.
We're working on identifying the cause.
 
Top Bottom