Reverting user edits can out-of-memory

Xon

Well-known member
Affected version
2.2.7
The UserRevertMessageEdit job finds all edits a user has made in a timeframe and then reverts in reverse order. Then for each revert, it loads all edits for the linked content.

This can result in the same content continuously being reverted if it has many edits, which can consume significant amounts of memory if the content has been spammed significantly. Worse, the more attempts at reverting edits, the worse the problem gets.

This job should only make one revert for per piece of content, and should actively flushing the entity cache to ensure the memory overhead is kept low.

The use case is I had a user who has repeatedly edited many posts upto the content limit several hundred times each in a very short window. This resulting in about ~512mb of memory usage trying to use the admin tools to revert the edits.
 
Last edited:
Another flaw; if an admin reverts their own edits and they have enough edits to trigger a page refresh; it looks to be possible for the job to never finish. (the revert feature should have a start +end time to consider reverts for to avoid this)

This is because new revert edits by the admin are being added to the end. But this probably will OOM first and kill the job as every edit for a content appears to be loaded in revertToHistory
 
Last edited:
Another pain point is if a moderator has edited the post, the bulk-revert feature will ignore this and blindly revert to an edit made by the user.
 
Top Bottom