Fixed AbstractRebuildJob can result in tasks running ad infinitum

PaulB

Well-known member
Affected version
2.2.10 Patch 1
If getNextIds takes too long, as can happen with especially large or complex tables, run will exit without attempting to rebuild any of the IDs. That will result in $data->data['start'] being left unchanged, and run will keep retrying with the same $this->data['start'] value over and over again.

Logic from \XF\Job\AbstractRebuildJob::run:
PHP:
public function run($maxRunTime)
{
   $startTime = microtime(true);

   // ...

   $ids = $this->getNextIds($this->data['start'], $this->data['batch']);  // On slow servers, this could take a while

   // ...

   foreach ($ids AS $id)
   {
      if (microtime(true) - $startTime >= $maxRunTime)
      {
         break;  // This can trigger on the very first loop
      }
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.12).

Change log:
Ensure job max run-time checks occur at end of loops
There may be a delay before changes are rolled out to the XenForo Community.
 
Top Bottom