Installation fails if cron runs in parallel

Created on 24 January 2025, 16 days ago

Problem/Motivation

This issue was initially reported in 🐛 Installation fails if cron runs in parallel Active . During the Drupal/Drupal CMS installation, the process fails if an automated cron job is triggered and executed in parallel to the installation. This can occur when certain routes, like CSS/JS asset paths, are accessed during the installation batch process.

Steps to reproduce

  1. Begin the installation of the Drupal Standard profile via the installation interface.
  2. During the installation batch process, manually access any CSS/JS asset route, such as: <YOUR_DOMAIN>/sites/default/files/css/test.css
  3. This access will trigger automated_cron, potentially causing the installation to fail.

Proposed resolution

As the Cron execution was removed during the installation by 📌 Remove the automatic cron run from the installer Needs work , if we introduce a validation step to ensure the cron job is only executed after the installation is fully completed. This can be done by modifying the run() function in Cron.php to include a check for the install_time state variable.

Proposed code snippet:

    // We can only run cron if the installation has been completed.
    if (!$this->state->get('install_time')) {
      $this->logger->warning('Attempting to run cron while the website is not fully installed.');
      return FALSE;
    }

This adjustment will prevent cron jobs from running prematurely during the installation process and help avoid failures.

🐛 Bug report
Status

Active

Version

11.1 🔥

Component

cron system

Created by

🇧🇷Brazil hfernandes

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024