Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Two of the RTBC issues I am following just got bumped to NW because MonthDatePluginTest
failed:
- #2953111: Only migrate role permissions that exist on the destination: https://www.drupal.org/pift-ci-job/2021261
- #2882276: Extended callback process plugin to call functions with multiple parameters: https://www.drupal.org/pift-ci-job/2021350
Here is the test failure from the first one. The second is similar, but with a different pseudo-random string.
1) Drupal\Tests\views\Functional\Plugin\MonthDatePluginTest::testMonthDatePlugin
Behat\Mink\Exception\ResponseTextException: The text "ugxIiAQx" appears in the text of this page, but it should not.
/var/www/html/vendor/behat/mink/src/WebAssert.php:785
/var/www/html/vendor/behat/mink/src/WebAssert.php:279
/var/www/html/core/tests/Drupal/Tests/WebAssert.php:896
/var/www/html/core/modules/views/tests/src/Functional/Plugin/MonthDatePluginTest.php:81
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:703
ERRORS!
Tests: 1, Assertions: 3, Errors: 1.
Steps to reproduce
Run the MonthDatePluginTest when Sydney is not observing DST.
Proposed resolution
#4: Use dates that are not the first of the month, since time zone conversions can switch them to a different month.
#15: When creating nodes with specific timestamps, make those timestamps in UTC.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#27 | 3207086-26-9.2.x-should-not-fail-but-does.patch | 1.94 KB | Spokje |
#15 | 3207086.patch | 1.13 KB | larowlan |
#4 | 3207086-4.patch | 834 bytes | benjifisher |
Comments
Comment #2
benjifisherWhat timezone does the testbot live in? Did it just switch to DST?
Comment #3
benjifisherAnother victim: #2867520: Dropdown menu is not vertically aligned.
Comment #4
benjifisherI think that @xjm once told me that issues like this should be considered Critical. Let's at least call this major.
I asked on Slack,
and @larowlan replied,
so I think my guess is right. Changing the dates of the test nodes from 2020-10-01 and 2020-11-01 to 2020-10-05 and 2020-11-05 fixes the problem when I run the test locally. Patch attached.
Comment #5
benjifisherIn case anyone is curious about why timezones were my first guess. The name of the test is a hint. In addition, I used to be active on the Vim users' mailing list. Once or twice a year (I forget whether it was the start or end of DST or both) there would be a flurry of bug reports from Windows users.
Comment #7
benjifisherComment #9
benjifisherI am crediting @mondrake because they added #3207083: [HEAD BROKEN] Drupal\Tests\views\Functional\Plugin\MonthDatePluginTest::testMonthDatePlugin started failing on DrupalCI a couple of hours before I added this issue.
Comment #10
benjifisherMore victims:
I think that is all at this point. I added comments to each with a link to this issue. Let's hope people wait until this issue is fixed before asking the testbot to try again.
Comment #11
benjifisherSince this bug is time-sensitive, I want to get this on the record while I can reproduce the failing test. I can reproduce the problem locally, and my patch fixes it.
Comment #12
jhodgdonAnother fail on #3087218: Help searches fail if site is not fully indexed, and users do not know why. This many fails once a year seems critical to me. I'm not sure it counts as "random", but it's definitely bad.
The analysis of the problem and the fix both make good sense. Let's get this in.
Comment #13
benjifisherAnother one: #3173900: Refactor Olivero's JavaScript Drupal behaviors to use once().
I do not 100% understand how today's TZ shift affects dates from a few months ago, but I do know that if you shift 2020-11-01 00:00:00 by one hour in the wrong direction, then it will show up on the page for October, which is what happens in the test. Since the patch makes the test pass, I am about 99.99% confident that this is the right explanation.
Comment #14
nod_we can add #1870006: HTML5 validation with table sticky header is misaligned over the toolbar to the list
Comment #15
larowlanThe test fails because the timestamp stored in the database should be calculated in UTC, not Australia/Sydney
See https://3v4l.org/Q8ajV
This is a more robust fix in my opinion
No interdiff.
Comment #16
larowlanComment #17
Spokje- Root cause explained
- Green Test result
RTBC for me.
Kudos to @larowlan for finding the root cause and to @benjifisher for linking it to timezones! 🙏
Comment #18
SpokjeBumping this to
Critical
, because:- Every Core issue that is tested will fail and not everybody will understand why and/or have seen this issue. This might/will cause a lot of duplicate issues to this one.
- Core issues on RTBC that are being retested as part of the "Retest every 2 days"-program will fail and loose their RTBC status to a Needs Work one. Even if the next round of retesting in 2 days will turn out fine after this issue is committed, I'm not sure the RTBC status will be re-set automagically.
On top of that: In this 2 day period, there will be a lot of issues that are actually RTBC (so most probably committable), not showing up in the overview with that status. So a lot of tested issues will be delayed in being committed.
All in all a lot of housekeeping work that nobody likes IMHO.
Comment #19
mondrakeComment #20
mondrakeNot random...
Comment #23
catchCommitted/pushed to 9.2.x and cherry-picked to 9.1.x, thanks! Nice one finding the real problem.
Comment #24
benjifisherRe #18: The issue was already promoted to Critical. I accidentally set it back to Major in #13.
I am updating the issue summary: the test failure is still reproducible even though we are past the DST change. I think that means the test (before this issue was fixed) would fail whenever Sydney is on Standard Time.
It looks as though #2969107: 500 error on passing invalid month to MonthDate view argument handler was committed to the 8.9.x branch. I think that means we should backport this issue, too. I tested locally with and without the patch from #14: the test fails without the patch.
Comment #25
benjifisherOops, my issue summary update was not quite right.
Comment #26
benjifisherI am not sure that we have a complete understanding of the problem here.
The patch in #4 and the one in #15 both get the test to pass. One patch moves the dates to the 5'th of the month instead of the 1'st. The other patch has the effect of moving the times from 00:00:00 to 10:00:00 or 11:00:00 (ST/DST). Either change is enough to protect the timestamps from moving to the wrong month if the TZ calculation is off by 1 hour because of DST confusion.
This test started failing when Sydney switched from DST to ST. The problem is not that our timestamps are in the wrong timezone. The problem is that somewhere the DST adjustment is off.
Is the patch in #15 really better than the one in #4? It is if you think that the right thing to do is express all times in UTC. If that were the case, then I would expect
to reliably have its month set to September, not October. In other words, I would expect the test to pass with the attached patch (applied to 9.2.x, where this issue is already fixed). When I test locally, it fails.
I will not ask the testbot to try the attached patch, because I want to keep the status at RTBC for 8.9.x.
If I am right that we still have work to do, then I think we can do it in a non-critical follow-up issue.
Comment #27
Spokje#24:
(As usual) @benjifisher is spot on. D8.9.x tests are failing due to this, backport is needed.
Here's an example: https://www.drupal.org/pift-ci-job/2022042
#26:
There's definitely a problem there that needs a follow-up. Added a slightly smaller patch (@benjifisher seems to have left his drush reference in the patch), but for me it fails locally as well.
Currently the patch is tested against 9.2.x here: #3191612-12: [Ignore] In space (and/or this issue), no one can hear patches scream
I expect it to fail as well.
Comment #28
catchOK I've cherry-picked back to 8.9.x, and opened a follow-up at #3207183: Views arguments do not apply DST adjustment correctly.
Comment #29
benjifisher@Spokje:
Thanks for checking!
I was not able to sleep last night. When I get out of bed because a question is nagging me and I just have to test it, I am more likely to make mistakes like that.
@catch: Thanks for creating the follow-up issue.
I am crediting @jhodgdon for reviewing the patch in #4.
Comment #31
xjm