We are currently having issues with the cron-hook of storage_api.

If i run the SQL from _storage_check_files manually i get 379.447 entries that cron should go through. This number never seems to drop, only increase, and the cron-run never succeeds.

I think i have located the source of the problem in storage.inc line 712:

  // If the storage has a single instance in a container that is not
  // propagating, then we are done.
  if ($this->file_id) {
    $query = db_select('storage_instance');
    $query->join('storage_class_container', NULL, 'storage_instance.container_id = storage_class_container.container_id');
    $query->join('storage_selector', NULL, 'storage_class_container.class_id = storage_selector.class_id');

    $count = $query->condition('storage_instance.file_id', $this->file_id)
      ->condition('storage_class_container.propagate', 0)
      ->condition('storage_selector.selector_id', $this->selector_id)
      ->countQuery()
      ->execute()
      ->fetchField();

    if ($count) {
      return;
    }

If the last condition is true, the file is still marked as one that should be processed by cron, and will probably return in the same result the next time.

This does not seem right. Maybe it should mark this storage as idle (STORAGE_STATUS_IDLE) as it is on line 779:

  if ($this->selector_id) {
    $this->initial_container_id = NULL;
    $this->status = STORAGE_STATUS_IDLE;
    $this->update();
  }
CommentFileSizeAuthor
#2 storage_entries_not-2597119-2.patch290 bytesmian3010
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mian3010 created an issue. See original summary.

mian3010’s picture

Attached proposed patch.

Perignon’s picture

Thanks for the patch. Looking it over now.

Perignon’s picture

Did you get this tested locally?

Perignon’s picture

Status: Active » Needs review

Kick testbot off.

mian3010’s picture

I have tested it locally, and it seems to work.

I can confirm that the number of unprocessed items (1.358.171 locally) is falling quickly when running cron. That was not the case before the patch.

mian3010’s picture

I can confirm that the number of entries that cron should process has reached 0 both locally and on our pre-production environment.

Perignon’s picture

Awesome!

  • Perignon committed 76d38aa on authored by mian3010
    Issue #2597119 by mian3010: Storage-entries not marked as processed by...
Perignon’s picture

Just pushed the commit. There was also another commit just updated today that I got in from Github.

Perignon’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.