StandardPerformanceTest::testAnonymous is hard to get to pass locally

Created on 9 April 2024, 8 months ago
Updated 1 May 2024, 8 months ago

Problem/Motivation

When I run StandardPerformanceTest::testAnonymous locally sometimes the following queries are run and sometimes they are not:

-    29 => 'SELECT "base_table"."id" AS "id", "base_table"."path" AS "path", "base_table"."alias" AS "alias", "base_table"."langcode" AS "langcode" FROM "path_alias" "base_table" WHERE ("base_table"."status" = 1) AND ("base_table"."alias" LIKE "CSS_FILE" ESCAPE '\\') AND ("base_table"."langcode" IN ("en", "und")) ORDER BY "base_table"."langcode" ASC, "base_table"."id" DESC'
-    30 => 'SELECT "name", "route", "fit" FROM "router" WHERE "pattern_outline" IN ( "/sites/simpletest/TEST_ID/files/css/CSS_FILE", "/sites/simpletest/TEST_ID/files/css/%", "/sites/simpletest/TEST_ID/files/%/CSS_FILE", "/sites/simpletest/%/files/%/CSS_FILE", "/sites/simpletest/%/%/%/CSS_FILE", "/sites/%/TEST_ID/%/css/%", "/sites/simpletest/TEST_ID/files/css", "/sites/simpletest/TEST_ID/files/%", "/sites/simpletest/TEST_ID/%/css", "/sites/simpletest/TEST_ID/%/%", "/sites/simpletest/TEST_ID/files/css/%"0, "/sites/simpletest/TEST_ID/files/css/%"1, "/sites/simpletest/TEST_ID/files/css/%"2, "/sites/simpletest/TEST_ID/files/css/%"3, "/sites/simpletest/TEST_ID/files/css/%"4, "/sites/simpletest/TEST_ID/files/css/%"5, "/sites/simpletest/TEST_ID/files/css/%"6, "/sites/simpletest/TEST_ID/files/css/%"7, "/sites/simpletest/TEST_ID/files/css/%"8, "/sites/simpletest/TEST_ID/files/css/%"9, "/sites/simpletest/TEST_ID/files/%/CSS_FILE"0, "/sites/simpletest/TEST_ID/files/%/CSS_FILE"1, "/sites/simpletest/TEST_ID/files/%/CSS_FILE"2, "/sites/simpletest/TEST_ID/files/%/CSS_FILE"3 ) AND "number_parts" >= 6'

This leads to random fails and makes the test hard to maintain.

Steps to reproduce

Proposed resolution

@catch thinks this is due to CSS aggregates being created so we should try to create them fix. Clear the cache and but not the aggregates and profit.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Fixed

Version

10.3

Component
PHPUnit 

Last updated about 21 hours ago

Created by

🇬🇧United Kingdom alexpott 🇪🇺🌍

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

Merge Requests

Comments & Activities

  • Issue created by @alexpott
  • First commit to issue fork.
  • Pipeline finished with Canceled
    8 months ago
    Total: 825s
    #141888
  • Pipeline finished with Failed
    8 months ago
    Total: 973s
    #141908
  • Pipeline finished with Failed
    8 months ago
    Total: 330s
    #141937
  • Pipeline finished with Failed
    8 months ago
    Total: 1079s
    #141951
  • Pipeline finished with Canceled
    8 months ago
    Total: 635s
    #141984
  • Pipeline finished with Canceled
    8 months ago
    Total: 646s
    #141994
  • Pipeline finished with Canceled
    8 months ago
    Total: 579s
    #142009
  • Pipeline finished with Failed
    8 months ago
    Total: 188s
    #142022
  • Pipeline finished with Canceled
    8 months ago
    #142029
  • Pipeline finished with Failed
    8 months ago
    Total: 1142s
    #142042
  • Pipeline finished with Canceled
    8 months ago
    Total: 696s
    #142093
  • Pipeline finished with Canceled
    8 months ago
    #142104
  • Pipeline finished with Canceled
    8 months ago
    Total: 555s
    #142115
  • Pipeline finished with Canceled
    8 months ago
    Total: 609s
    #142128
  • Pipeline finished with Canceled
    8 months ago
    Total: 591s
    #142135
  • Status changed to Needs review 8 months ago
  • 🇬🇧United Kingdom catch

    OK this subtly changes all the test assumptions but it specifically does get rid of those two queries so hopefully this will get consistent results on @alexpott's local too. I'm not able to run functional js tests locally at the moment because chromedriver keeps crashing all the time (and didn't figure out why), so excuse all the commits here.

    Remove a couple of assertBetween() too since ideally we don't need to do that any more.

    After doing all this, I realised adding an extra sleep() after the first request might have been enough... this is probably better than doing that.

  • Pipeline finished with Failed
    8 months ago
    Total: 1014s
    #142145
  • Status changed to Needs work 8 months ago
  • 🇬🇧United Kingdom alexpott 🇪🇺🌍

    I'm getting an error with this

    ArgumentCountError: Too few arguments to function Drupal\Core\ProxyClass\Lock\DatabaseLockBackend::wait(), 0 passed in /Volumes/dev/sites/drupal8alt.dev/core/modules/system/tests/modules/performance_test/src/PerformanceDataCollector.php on line 74 and at least 1 expected in Drupal\Core\ProxyClass\Lock\DatabaseLockBackend->wait() (line 113 of core/lib/Drupal/Core/ProxyClass/Lock/DatabaseLockBackend.php).

  • Pipeline finished with Canceled
    8 months ago
    Total: 750s
    #142163
  • 🇬🇧United Kingdom alexpott 🇪🇺🌍

    #5 reveals a bug we merged a while ago. Odd.

  • Pipeline finished with Canceled
    8 months ago
    Total: 733s
    #142172
  • Status changed to Needs review 8 months ago
  • 🇬🇧United Kingdom catch

    As soon as I got this back to green, it ran into merge conflicts. But then I tried to fix chromedriver locally again and may have done so finally, (increased shm_size in docker for the chromedriver image) -hopefully back to green again.

    The lock wait issue can only happen if two requests are trying to write performance data at the same time, which should no longer be happening when we're trying to actually collect data to assert on, but could be happening in the initial cold cache requests where we warm up.

    Re-did the locking logic slightly so it at least shouldn't error.

  • Pipeline finished with Success
    8 months ago
    Total: 1092s
    #142216
  • Status changed to Needs work 8 months ago
  • The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • Status changed to Needs review 8 months ago
  • 🇬🇧United Kingdom catch

    Rebased.

  • Pipeline finished with Success
    8 months ago
    Total: 961s
    #143278
  • Status changed to Needs work 8 months ago
  • The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • Status changed to Needs review 8 months ago
  • 🇬🇧United Kingdom catch

    Rebased.

  • Status changed to RTBC 8 months ago
  • 🇬🇧United Kingdom alexpott 🇪🇺🌍

    This works great and passes locally for me. Nice!

    • longwave committed 35b7c9f2 on 10.3.x
      Issue #3439671 by catch, alexpott: StandardPerformanceTest::...
    • longwave committed 4d00efb6 on 11.x
      Issue #3439671 by catch, alexpott: StandardPerformanceTest::...
  • Status changed to Fixed 8 months ago
  • 🇬🇧United Kingdom longwave UK

    Committed 4d00efb and pushed to 11.x. Thanks!
    Committed 35b7c9f and pushed to 10.3.x. Thanks!

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

Production build 0.71.5 2024