AbstractRebuildJob can result in tasks running ad infinitum


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:
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