Problem/Motivation

I recently set up update status notifications on a D6 site, and realised I was getting the notifications on Tuesdays. Since SAs go out on Wednesdays this means it could be a full week between the SA and the notification.

Currently you can specify the interval for checks/notifications, but not the day of the week (unless you manually change the tracking variable to a timestamp on the day you want).

Seems like it would make more sense to allow choosing the day(s) of the week to get notifications on, as well as forcing a refresh of the data just before sending the notification.

Steps to reproduce

  1. Install a clean site.
  2. Enable update notification emails during installation, configure it for "weekly".
  3. Notice when emails go out.

Proposed resolution

  1. On the Update Manager settings form (/admin/reports/updates/settings), when selecting "Weekly" for the "Check for updates" setting, expose another setting to select which day of the week.
  2. The day should default to Thursday.
  3. Update Manager should always refresh data before sending any notification emails.

Remaining tasks

  1. Confirm that Update Manager is sending emails without refetching data and decide if fixing that should be in scope with the rest of this or split off to a separate issue.
  2. Confirm the right UI text for the new setting.
  3. ✅ Implement the feature.
  4. ✅ Update summary with After screenshot.
  5. Reviews + refinements.

User interface changes

Before

The existing (10.1.x) Update Manager settings form

After

API changes

None.

Data model changes

TBD. New setting in update.settings.yml, probably under the check section.

Release notes snippet

TBD.

Issue fork drupal-1566662

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

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.

smustgrave’s picture

Issue summary: View changes
Issue tags: +Needs issue summary update

Brought this up in #yes-no-queue and @catch mentioned this could still be valid.

Sounds like the request is to be able to select a day when selecting weekly under "Check for Updates"

dww’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update
StatusFileSize
new50.35 KB

Good point. 😅 Needs subsystem maintainer review. Here's a real summary.

yash.rode’s picture

Assigned: Unassigned » yash.rode
Status: Active » Needs work

Giving this a shot.

yash.rode’s picture

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

yash.rode’s picture

Assigned: yash.rode » Unassigned
Status: Needs work » Needs review

Added config and changed update_cron hook to take day of week in to account.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs upgrade path, +Needs tests

With the schema updates image we will need an upgrade path for that.

Also will need test coverage

yash.rode’s picture

Status: Needs work » Needs review
Issue tags: -Needs upgrade path

Can someone, please, provide instructions on how can we write a test for this?

smustgrave’s picture

Brought could use a mock right? To pretend it's Thursday.

yash.rode’s picture

Issue tags: -Needs tests

Added test coverage. Up for review.

smustgrave’s picture

Status: Needs review » Needs work

Just realized Issue summary has some parts marked TBD that will need to be filled in.

But the test, least from what I can tell, is testing sending the notification always on "today" so not testing the Thursday feature I imagine.

yash.rode’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new41.57 KB

The remaining tasks seem to be review related. So, keeping them pending.

But the test, is testing sending the notification always on "today" so not testing the Thursday feature I imagine.

The default day is Thursday, but we can set it to anything we want. In test, I am setting the update day to today and checking if I get the update notification email today. I couldn't find a way to pretend the other day to run cron. Other than that, I have added one more test case to confirm this by checking the notification is not sent on other days than the configured day.

yash.rode’s picture

Title: Update module should send notifications on Thursdays » Update module should send notifications on configured day
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Ah thanks for explaining makes more sense.

xjm’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs subsystem maintainer review

This is a great idea!

Have we accounted for the fact that the week starts on different days depending on your locale? "Thursday" can be counted as either day 4 or day 5, depending on whether the location's week starts on a Sunday. Furthermore, while scheduling updates for the day after the default security window is good -- but! It doesn't help Australia and New Zealand, because Thursday for them starts before the scheduled hours of the security window. So they need it the most but they'll always be one full week out of date.

I think we're on the right track here, but we need to think a little more about the datetime aspects, so that we have better defaults and configuration options that get localized properly. I'd suggest reaching out to DateTime maintainers as well as people who are actually from Australia and New Zealand, to get a sense of an internationalized version of this that's less US/EU-centric in its conception.

@yash.rode, FWIW, your persepctive on how this affects Indian sites is probably worthwhile as well, since midnight actually happens smack in the middle of the security release window for India (if you are still in Pune that is).

Tagging for subsystem maintainer review, but I actually mean the DateTime maintainers who understand the dark corners of timezone compatibility. There is no tag for "Needs APAC sense check." 😉

joachim’s picture

Status: Needs review » Needs work

> Since SAs go out on Wednesdays this means it could be a full week between the SA and the notification.

I can't actually find that information online. Googling "drupal SA window" gets me only past SAs. https://www.drupal.org/security doesn't say.

yash.rode’s picture

Status: Needs work » Needs review

Changed the description to take into account timezone and changed the day format.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Still needs submaintainer sign off but to keep the issue from stalling moving to RTBC.

Seems all threads have been resolved
Verified post_update still runs without issue.

dww’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs subsystem maintainer review +Needs issue summary update

Thanks for keeping this moving forward! I opened some new threads on the MR. The most significant being this:

Nice touch on this help text to localize it for the person configuring the site. However, the information about 6pm UTC is potentially frustrating since people have no control over what time of day the check is happening. 😞 That's nice to know it'll be "Thursday at 2am" for me, but does that mean I have to set it for Friday to be "safe", since maybe this will run at 12:01am on Thursday?

I'm not sure what to do with this. I think it's getting too complicated to add a time of day config knob, too, but maybe we "need" that. Or we need to invent something arbitrary like we always do these checks as close to "noon local time" as possible.

But if we're going to go that far, why make this a new config knob at all? Why not just automatically have the check logic know that if you're only checking weekly, it should know this:

> Security releases happen between 16:00 UTC and 22:00 UTC.

If the knob is configured for weekly checks, it should always aim to check as soon after Wednesday at 22:00 UTC as possible.

In theory, that policy could change, and we'll regret hard-coding this, but we release core often enough that if we ever did need to change this, we could...

I have some regret I didn't consider this when I first reviewed the issue, but at least I thought of it now! 😉 Thankfully, it should result in a much smaller change to core overall, and we don't have to further complicate the UI at all.

If there are no objections to my counter-proposal, this needs a summary update and an almost entirely different change. Perhaps it'd be cleaner in a new MR.

Thanks/sorry!
-Derek

p.s. Saving credit for everyone who's participated so far, since everything has been a meaningful contribution towards fixing this.

dww’s picture

tedbow’s picture

@dww #34 Sounds like a good idea to me.

This probably not an issue but just thought I would raise it just in case....
Is the Update XML served by a CDN? If not would there be a problem with every site's cron requesting at around the same time? I figure it will not be a problem because cron is probably not going to run exactly on the hour for sites so it will vary.

Again i am in favor of @dww's idea just thought I would raise that issue in case it raise any flags with anyone more knowledgeable about such things than myself

catch’s picture

One thing with #36, is it will only happen on sites that update to the release with this in so it should be a small problem that gradually gets worse rather than immediate, giving time tweaknedge caches if needed. Might also result in more cache hits if we're lucky too.

drumm’s picture

Is the Update XML served by a CDN? If not would there be a problem with every site's cron requesting at around the same time? I figure it will not be a problem because cron is probably not going to run exactly on the hour for sites so it will vary.

As long as this is true, cron doesn’t run exactly on the hour, it’s all good. Our CDN does handle spikes at the top of the hour already, since it is common configuration. Its better to move away from that for any default configuration.

ressa’s picture

Updates and alert emails are sent once every 24 hours, which can result in an update alert getting sent 23 hours after a security update was released.

Since Drupal security updates are usually sent out around 18:00 GMT, it would be nice if there was a setting to define exactly when to check for updates and send email updates, for example at 20:00 GMT.

Maybe it's even worth considering a new option, which is "Check for updates > Daily > Every Hour" if you as an administrator want to make sure you always get email alerts ASAP?

catch’s picture

Maybe it's even worth considering a new option, which is "Check for updates > Daily > Every Hour" if you as an administrator want to make sure you always get email alerts ASAP?

That would be a lot of additional traffic given the relatively low frequency of security releases on Drupal.org, update module already makes one request per installed project iirc, so with 200 projects installed that's 200 requests per week, but if we did it per hour it would be 33,600 requests per week.

If we wanted to do something like that, I think we'd need to implement some kind of security release canary - e.g. an endpoint on Drupal.org that's a timestamp of the last security release (against any project), and if it's newer than when we last checked for updates, trigger a check then. Having written this out, that might be a viable approach, although we'd still need to check for non-security updates much less frequently (but regularly in case there's no security release for weeks), so would still need something for that.

dww’s picture

I still think #34 makes more sense and would be vastly easier to implement than #39 or #40

dww’s picture

P.s. if you want “immediate” email notifications of security updates, subscribe to the security announcements newsletter and/or consume the feed via RSS.

drumm’s picture

Checking frequently isn’t an issue for traffic server-side, the CDN absorbs that.

In highly critical security releases, even checking at the end of the security release window is not ideal. A bad enough vulnerability would be exploited before the window is over. And the window is ideal, but not a rule. If there’s a 0-day, any day is good for fixing the issue. If there’s some issue in the release process, late is better than waiting another week. Even under ideal conditions, we might reschedule, these sorts of things should not be hard-coded into Drupal core.

The one thing I would ask for is encouraging skewing when sites ask for updates, so we don’t have a spike of traffic at the top of an hour, its spread out throughout an hour.

catch’s picture

Checking frequently isn’t an issue for traffic server-side, the CDN absorbs that.

That's good to know. We previously had serious performance issues when update status checked too often, e.g. #220592: Core cache API breaks update.module: fetches data way too often, kills site performance, etc but that issue was a long time ago.

edited to add: doesn't the CDN also cost money for bandwidth/requests though? But then I guess update module pinging even x 200 might be a tiny fraction of that anyway.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.