We recently upgraded to D8 and I have been experiencing weird issues with Cron. Specifically, whenever the Cron is running, web pages are taking forever to load because cron is running some JS on the front end of any page you attempt to load. Specifically, it appears to be a timeout method that is holding up the page load.

NOTE: I will update this post and provide the exact JS file and function that is running on the front end the next time it happens to me. At the time of writing, cron wasn't running and therefore I couldn't inspect the web page to get the running method

I know it's not the CPU on the server because when cron was running it never got above 20% CPU utilization.

Isn't cron suppose to run in the background? Why would cron have a JS file being executed on every page, causing any page not to load until cron finishes?

  • You should never use the built-in "Run cron every x hour" under heavy load in production. Run cron from outside using the link from the config page.
    – 4uk4
    Mar 31, 2021 at 16:28
  • Why would they provide a feature that "you should never use"? That seems ridiculous... How would you go about running cron from "outside" using the link and have it do so every hour?
    – BlondeSwan
    Mar 31, 2021 at 16:37
  • crontab -e from the command line or if you have a webserver admin panel something like this blog.cpanel.com/how-to-configure-a-cron-job
    – 4uk4
    Mar 31, 2021 at 17:06
  • Yes, @4k4 is correct: It should not be used in a production site with much traffic. The module implementing that functionality, which isn't necessary to run Drupal cron tasks, was thought for small sites. It also help users who cannot set Drupal cron tasks from cPanel, or similar software. The module is part of Drupal core, but that doesn't mean that every site should use it. I personally don't use it, even for small size sites.
    – apaderno
    Apr 1, 2021 at 8:42
  • 2
    Yes, interesting is the name before it was a core module: Add a poormanscron-like feature to core
    – 4uk4
    Apr 1, 2021 at 8:55

1 Answer 1


Part of the settings on /admin/config/system/cron are for the Automated Cron module, which adds them via automated_cron_form_system_cron_settings_alter(). The form field it adds has the following description.

More information about setting up scheduled tasks can be found by reading the cron tutorial on drupal.org.

If you follow that link, you will read the following sentences. (Emphasis is mine.)

The automated cron module has the disadvantage that it is triggered by a request, and the unlucky user who sends the request may experience a fairly long delay. For this reason, the automated cron is typically used by smaller sites that are unable to create a cron job manually, e.g. using the Linux crontab. If crontab is desired, Drupal console command may be used to simplify the configuration (rather than curling the long URL show in /admin/config/system/cron. Here is an example crontab entry:

30 * * * * web_user /var/www/html/vendor/bin/drupal --root=/var/www/html/docroot cron:execute > /dev/null 2>&1

Essentially, what you are experiencing is how the Automated Cron module work, but that isn't the only way to run cron tasks for Drupal.
You could also pass the URL shown on on /admin/config/system/cron after To run cron from outside the site, go to to wget or curl. This requires that you have access to, for example, cPanel for the site, which allows to set cron tasks.

  • So basically, Drupal cron isn't an actual cron.. Awesome. What a classic Drupal implementation
    – BlondeSwan
    Apr 1, 2021 at 14:35
  • Yes, Automated cron isn't cron in the sense used by Linux and other OSes. It's a way for running some code without depending from settings Drupal doesn't directly control.
    – apaderno
    Apr 1, 2021 at 14:40
  • They should really not call it cron then. What a joke.
    – BlondeSwan
    Apr 1, 2021 at 14:42
  • 2
    @BlondeSwan, do you have a better idea what Drupal can do from inside of the PHP application if the site admin is not willing to invest the money or time to setup a proper cron?
    – 4uk4
    Apr 1, 2021 at 15:41
  • 1
    Sounds like a good plan. The button to run cron manually is by the way not the link, this triggers cron once by submitting the admin form. For the real cron task wget or curl the long link containing the secret authentication key. This will run all Cron Jobs you've wrote and is not a workaround but the final solution according to the docs.
    – 4uk4
    Apr 1, 2021 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.