Skip to content

✔️ Ideas to reduce flutter build apk flakes on CI #159000

Closed

Description

@matanlurey

Working theory: This is caused by #51421.


A lot of credit goes both to @gmackall and @reidbaker for offline conversations that led to this issue.

As of today (2024-11-15), different integration tests (in particular, tooling integration tests, if that ends up mattering) are having somewhat significant and currently undiagnosed problems with tests that call (and block on) flutter build apk.

For example:

Three possible things happen that end up leading to failures:

  1. The test times out (taking longer than 15m) or the shard times out (taking longer than 30-60m)
  2. The test fails due to a Java Heap/OOM
  3. The test fails due to (hypothesis) the OS killing Gradle due to low memory

Some things to try:

  • Try creating a bringup: true shard where failures happen somewhat consistently to try fixes
  • Try adding --verbose to get information about the version of Gradle/Gradle settings being used
  • Remove the no-daemon from recipes which doesn't appear to be having any effect/is confusing
  • Try using jps to list active Java processes and memory usage between/after tests.
  • Try running with double the amount of RAM to see if higher memory lowers flakes significantly

/cc @andrewkolos @bkonyi.

Activity

  1. added
    platform-androidAndroid applications specifically
    P1High-priority issues at the top of the work list
    c: tech-debtTechnical debt, code quality, testing, etc.
    c: flakeTests that sometimes, but not always, incorrectly pass
    fyi-androidFor the attention of Android platform team
    fyi-infraFor the attention of Infrastructure team
    team-toolOwned by Flutter Tool team
    on Nov 15, 2024
  2. self-assigned this
    on Nov 15, 2024
  3. matanlurey commented on Nov 18, 2024

    @matanlurey
    ContributorAuthor

    Unfortunately my bringup: true shard has ... yet to fail.

    I am not sure if its because the underlying issue has been resolved (and I could unskip the tests), if I'm missing some sort of condition that leads to these tests timing out (stale/corrupt caches), or more tests need to be run in a certain order to get into this bad state :-/

  4. reidbaker commented on Nov 18, 2024

    @reidbaker
    Contributor

    Is the current state that your bringup tests are a clone of an existing shard/subshard?

  5. matanlurey commented on Nov 18, 2024

    @matanlurey
    ContributorAuthor

    Is the current state that your bringup tests are a clone of an existing shard/subshard?

    No, because unfortunately that is impossible (#158972).

  6. gmackall commented on Nov 18, 2024

    @gmackall
    Member

    Do you know what the flake rate of the existing shard it copied is? Should we have expected to see one for certain by now?

    Perhaps there is some difference between staging and prod bots?

  7. matanlurey commented on Nov 18, 2024

    @matanlurey
    ContributorAuthor

    Do you know what the flake rate of the existing shard it copied is? Should we have expected to see one for certain by now?

    It was relatively high (6%) before I added the skip statements, though that did include timeouts that were a result of the shard being too large, so it is possible it just hasn't happened yet. I suppose I could use LED to try and "speed things up" :P

  8. matanlurey commented on Nov 18, 2024

    @matanlurey
    ContributorAuthor

    My current working theory is:

    1. Gradle is a high memory usage process
    2. Test suites that leak processes in the background have less memory available
    3. Test suites that run flutter build apk after leaky process tests are more likely to OOM/fail

    ... so, my next guess is solving #51421 is directly related to solving this issue (and that there is likely nothing directly we can or should do to change the Gradle configuration).

  9. gmackall commented on Nov 20, 2024

    @gmackall
    Member

    Not directly related to building apks, but another instance of something randomly taking much longer than expected:
    https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20build_android_host_app_with_module_source/235/overview

    flutter doctor taking over 5 minutes and causing a timeout

    Looks like there is an issue already #157513, not android test specific

  10. matanlurey commented on Nov 22, 2024

    @matanlurey
    ContributorAuthor

    I haven't observed a flake ever since the process cleanup, so I am closing for now.

  11. github-actions commented on Dec 6, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  12. locked as resolved and limited conversation to collaborators on Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listblockedIssue is blocked by another issuec: flakeTests that sometimes, but not always, incorrectly passc: tech-debtTechnical debt, code quality, testing, etc.fyi-androidFor the attention of Android platform teamfyi-infraFor the attention of Infrastructure teamplatform-androidAndroid applications specificallyteam-toolOwned by Flutter Tool team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions