I just had the following happen to me:

  • Start a rather lengthy batch operation (could easily run for 15 minutes).
  • Watch the progress bar fill up nicely.
  • All of the sudden: no movement, no ajax requests going out.
  • ¯\(°_o)/¯

 

After a little bit of log browsing and code diving I came to the following realization (theory):

  • Batch API seems to retrieve its data for each step of the process from the 'batch' table.
  • system_cron() runs a db_delete() on said table, possibly locking it.
  • Batch API tries to get data from a locked table and the entire batch halts.

 

Am I correct to think that any ill timed cron could seriously mess up batch operations?

Comments

kristiaanvandeneynde’s picture

Assigned: kristiaanvandeneynde » Unassigned
marcingy’s picture

Category: bug » support
Priority: Major » Normal

Only if the batch started more than 864000 seconds ago so approx 10 days. Moving to support request as issue is more than likely in your code

kristiaanvandeneynde’s picture

Category: support » bug

I've tried to reproduce the problem and I came to the conclusion that, if you start your cron at the (almost) exact same time of the batch page doing an ajax POST, you may run into this issue.

Doesn't the query lock the table and thus prevent Batch API from using it, regardless of the condition being met?

Until it is clear that this is not the case, I'd like to keep it under bug report.

marcingy’s picture

Category: bug » support

Please read my comment it deletes entries more than 10 days old therefore if both start at the same time nothing will be deleted. Back to support request.

kristiaanvandeneynde’s picture

The question isn't: does it delete something.
The question is: does it lock the table when it searches for something to delete?

As far as I can tell from the symptoms, it does.

kristiaanvandeneynde’s picture

Category: support » bug

Back to bug report until it's sure this isn't a locking issue

Fixdit’s picture

We too are finding a pattern between the cron running and the interruption of our batch API processes.

Version: 7.12 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.