Spin-off from #2289201: [Meta] Make drupal install and run within reasonable php memory limits so we can reset the memory requirements to lower levels.

The problem

I can't find the issue that added this, but from what I remember:

- the installer has a blocking cron run at the end - this makes it take longer and shows up in profiling, including via drush.
- we show a warning when cron hasn't run for X period of time.
- this used to happen immediately after installing
- to avoid the site from showing warnings just after install, we added a cron run to the end of the installer
- this was probably (not sure) before poormanscron was added to core

Proposed resolution

1. Remove the cron run from the installer and see if the warning even shows up any more now that poormanscron is enabled by default.
2. If the warning does show up, discuss some more.

Issue fork drupal-2422681

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

berdir’s picture

Status: Active » Needs review
StatusFileSize
new808 bytes

Ah, the comment in the code actually explains why it is done. *Because* of update.module. But with poormans cron, that's possibly OK too, then you get the warning on the second or third or so page request, but fairly soon enough as well.

That said, thinking about it, I'm actually relying on this right now, because my install profile includes default content and search_api, and I expect the search index to be populated after an installation, which happens because of the cron run. But I guess I can always add that back in my install profile, 5s more won't make a huge difference there.

Status: Needs review » Needs work

The last submitted patch, 1: cron-installer-2422681-1.patch, failed testing.

catch’s picture

Hmm so that comment also mentions search as well.

I'm wondering whether we should revisit #1599622: Run poormanscron via a non-blocking HTTP request first, all the blockers to that issue are in now.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: cron-installer-2422681-1.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

catch’s picture

berdir’s picture

Status: Needs work » Needs review

MR is green, but the previous run had 5+ random fails, and the JS one I can reproduce locally (sometimes), but also on 11.x I get that error there.

Still, that's a lot of bad luck, wondering if the removed cron somehow increaess the chance of those random fails.

longwave’s picture

I have been seeing multiple random fails on many core MRs recently, up to four jobs failing but that pass on retry, so not sure this is any worse.

nicxvan’s picture

nicxvan’s picture

Status: Needs review » Reviewed & tested by the community

I tested this against 3491780 which is why I found this old issue.

The issue there is that during install we don't load all theme hooks, but this is an issue during cron because items are rendered.

I think @longwave's comment has been addressed, feel free to put it back in needs work if you think it needs more discussion.

catch’s picture

Issue tags: +Needs manual testing

This looks really good. I had assumed Drupal CMS included automated_cron but it looks like it doesn't, opened #3492390: Add automated_cron to base recipe.

I think it would be good to manually test (unless we have exact test coverage) that installing umami or standard via the UI and cli, and then visiting the site, and then getting to admin/reports as quickly as possible via the admin menu, doesn't result in warnings on the status report that would be solved by running cron. It should not be possible, but it would be good to confirm.

nicxvan’s picture

Status: Reviewed & tested by the community » Needs work
berdir’s picture

Did some manual testing, with the UI installer, rushing through the configure page as quickly as I can.

On standard, it works well, I when I click on reports => status as quick as I can tells me that cron did run 8-10s ago and update status is there. Also no message on admin/config. Based on the timing of 8-10s, I suspect that cron already runs during the installer?

Umami is a bit slower because it has quite a bit it needs to index. I don't see a message on admin/config but the status report then is a bit confused. Cron is reported as having run also some 10s ago, but update module reports that it has no data. waiting a bit and refreshing then shows data. Maybe cron runs before update.module is enabled? I first thought that maybe the timestamp is set before the cron actually runs, but that doesn't seem to be the case.

It's only a warning and only on the status page and you have to be fairly quick to get there, I feel like that's an acceptable tradeoff?

catch’s picture

Based on the timing of 8-10s, I suspect that cron already runs during the installer?

I have a feeling it would run on the install_configure_form step since we have Drupal fully installed at that point, but haven't verified this. If so then that's good though because it'll be in kernel destruct and hence non-blocking on most environments, but also still very early in the process relative to being able to browse to an admin page.

It's also theoretically possible it could even end up running during the batch after automated_cron - but if that's the case, then same thing.

moshe weitzman’s picture

FWIW, I would not be surprised if automatic cron took some time to run, after it gets installed. In other words, I think it would be fine if it did nothing at install time. Its OK that module information would be unavailable for a bit.

alexpott’s picture

I have a feeling it would run on the install_configure_form step since we have Drupal fully installed at that point, but haven't verified this.

I checked this and we don't because we are relying on the terminate event and that is not called during the installer. It's only called by index.php and not be the request handling in install_drupal() ... so we only hit automated cron on the redirect to the frontpage from the installer. Which oddly feels good considering the update module is enabled on install_configure_form submission and we don't have an email address yet - as user 1 is configured there too.

catch’s picture

OK yes that seems ideal actually and probably consistent with @berdir's 8 seconds - it would include the entire request + browser rendering of the front page which is likely to be at least a second with caches being built etc. + some human clicking time to get to the reports page, plus the loading time of that page until it retrieves the timestamp.

catch’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs manual testing

That covers the manual testing I think.

catch’s picture

Status: Reviewed & tested by the community » Needs work

No wait we should fix the message in CronForm, not sure the test is really necessary but the grammar fix would be good..

catch’s picture

Status: Needs work » Needs review

We already have test coverage of the form, and it explicitly checks that we don't show 'years' on the page for when cron has never run, so it needs to be adapted anyway.

ressa’s picture

I have been running the installer repeatedly lately, making side-by-side recordings comparing Drupal 11.1 and Drupal 11.2, and I noticed a lot of time was spent on Cron.

So I was glad to find this issue, since the patch gets the Standard install down to around 5 seconds -- a big improvement, slicing even more time off, Drupal 11.1's 15 seconds and Drupal 11.2's 10 seconds.

Don't run Cron during install

No Cron during install

catch’s picture

Tentatively tagging for release highlights.

nicxvan’s picture

Status: Needs review » Reviewed & tested by the community

I think this is ready now, I think @berdir answered @alexpott's concern.

I was a little unsure about 33-34, but I think @catch was saying the text change was correct and I agree.

catch’s picture

Just to confirm 33-34 I think that's all OK now yeah.

alexpott’s picture

Saving issue credit

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 32a1337 and pushed to 11.x. Thanks!

  • alexpott committed 32a13379 on 11.x
    Issue #2422681 by berdir, catch, ressa, nicxvan, alexpott, longwave:...
andypost’s picture

Looks like it needs follow-up as help is not shown after install

Status: Fixed » Closed (fixed)

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

alexpott’s picture

Just found another reason why this is a good idea. During install we limit theme hooks to only those from system module - see \Drupal\Core\Theme\Registry::build() so any cron hooks that doing any theming are going to struggle.

I think separating cron from the installer is the best way to go here - rather than trying to make the full theme system available once all the modules and themes are installed.

casey’s picture

StatusFileSize
new3.22 KB

Patch from 32a1337 for usage with composer patches on D11.1 projects.