Run cron in a separate process to avoid a response delay

Created on 5 November 2010, almost 14 years ago
Updated 28 August 2023, about 1 year ago

Automatic cron is invoked during a page request, and for as long as cron is running, the page does not get sent to the browser. This can cause a significant delay in the page being rendered. This can be seen by putting a call to sleep(25) in hook_cron.

Also, if an error is encountered during cron invocation, it can output error text at the bottom of the rendered page. This can be seen by simply throwing an exception in hook_cron.

Both of these issues can be addressed by running cron in a separate process, forked from the process servicing the request. Not all environments are configured to make this possible; the Process Control extension must be installed in order for php to make use of fork.

For environments that do not support forking, we can gracefully fall back to the current behavior.

See the attached image for an example of an error message being appended to the display.

✨ Feature request
Status

Closed: duplicate

Version

9.5

Component
CronΒ  β†’

Last updated 5 days ago

No maintainer
Created by

πŸ‡ΊπŸ‡ΈUnited States paul.lovvik

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡­Switzerland Berdir Switzerland

    Yes, I agree this is a duplicate of #12. Which we also weren't able to get working until now. There was no update on this issue in 10 years, lets just close it?

    I'm not sure if automated cron even was a standalone module back then, it is now and anyone who is able to have a proper cron set up should absolutely not rely on it and uninstall it. Maybe we could do a better job at explaining this. Still seeing too many people confused about that admin setting and what it does.

Production build 0.71.5 2024