Repository navigation
Use hermetic cpython3 for GN actions and roll GN to f9eca75ae554 - #194454
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If both you and the PR author believe this PR qualifies for a test exemption, escalate to the tech lead for the changed area to review and apply the |
There was a problem hiding this comment.
Code Review
This pull request updates the GN configuration to use the hermetic Python 3 binary from DEPS instead of vpython3 as the script executable, aiming to reduce virtualenv store contention under high Ninja parallelism. It also adds the hermetic Python path to the license check exclusion list. The remaining changes consist of minor formatting updates, such as comment re-wrapping and empty line insertions, across numerous GN and GNI files. There are no review comments, so no additional feedback is provided.
gaaclarke
left a comment
There was a problem hiding this comment.
can you pull out the formatting changes into a different PR please?
Rolls GN from `81b24e01531e` to `f9eca75ae554` (last rolled in flutter#176119). flutter#194454 needs this to point `script_executable` at a `//` path, which landed in https://gn.googlesource.com/gn/+/4a060c55dcc5380837a8684949b74400e929b85e. The new `gn format` rewraps some comments and adds blank lines, so this PR also reformats 49 `.gn`/`.gni` files under `engine/src/flutter`. No semantic changes. I stopped at `f9eca75ae554` instead of GN tip because its child https://gn.googlesource.com/gn/+/526295467bd18f5f8d9cb11f03a1c56cb40b7b28 enables `check_includes_strict` by default, which breaks `gn gen --check` on most engine configs.
|
autosubmit label was removed for flutter/flutter/194454, because - This pull request has the |
|
Test exempt: only changes build files. |
Rolls GN from `81b24e01531e` to `f9eca75ae554` (last rolled in flutter#176119). flutter#194454 needs this to point `script_executable` at a `//` path, which landed in https://gn.googlesource.com/gn/+/4a060c55dcc5380837a8684949b74400e929b85e. The new `gn format` rewraps some comments and adds blank lines, so this PR also reformats 49 `.gn`/`.gni` files under `engine/src/flutter`. No semantic changes. I stopped at `f9eca75ae554` instead of GN tip because its child https://gn.googlesource.com/gn/+/526295467bd18f5f8d9cb11f03a1c56cb40b7b28 enables `check_includes_strict` by default, which breaks `gn gen --check` on most engine configs.
…lutter#194454) Depends on flutter#194471 `Linux local_engine_builds` fails on 16% of postsubmit runs when a Windows sub-build dies at `ACTION //flutter/third_party/angle:angle_commit_id` with `FAILED: gen/angle/angle_commit.h`. `engine/src/.gn` runs every GN action through `vpython3`, and on Windows more than 100 concurrent `vpython3.exe` processes contend on the shared virtualenv store. This PR fetches a hermetic `cpython3` through `DEPS` and points `script_executable` at it, the same way [Chromium](https://chromium.googlesource.com/chromium/src/+/ce8851b40f37e74adcb7813256930792f35b8039/.gn#12) and [ANGLE](https://chromium.googlesource.com/angle/angle/+/45c55079f225/.gn#17) do. This replaces flutter#193954, which used `python3` from `PATH`. ## The flake | Where | Failure rate | Window | |---|---|---| | Postsubmit, last 200 builds | **16.0%** (32/200) | `display builds\|windows/*` failing on `angle_commit.h` or `venv derivation`, Oct 3 to Oct 15 | | Try, without the fix (logging-only build) | 1/7 | one wave on [`65b69d1e0db`](mdebbar@65b69d1) | | Try, with the fix | **0/52** | see [Proof of fix](#proof-of-fix-after-the-fix) | Example postsubmit failures (`FAILURE` in `display builds|windows/*`): [4322](https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20local_engine_builds/4322/overview), [4314](https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20local_engine_builds/4314/overview), [4310](https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20local_engine_builds/4310/overview). ## Root cause 1. `engine/src/.gn` sets `script_executable = "vpython3"`, so every GN `action()` and the Windows [`tool("copy")`](https://github.com/flutter/flutter/blob/8274c72edd454f28f044908463289f7976b270af/engine/src/build/toolchain/win/BUILD.gn#L266) run through `vpython3.exe`. 2. `vpython3` finds its spec by walking up from the script. For `angle/src/commit_id.py` (stdlib only) it finds [`angle/vpython.toml`](https://flutter.googlesource.com/third_party/angle/+/a8d74ca3e5e9e4ffa241330ceedcbe302443e472/vpython.toml), which declares 80+ test wheels. 3. Under RBE (`ninja -j 1000`), the first ~340 steps are mostly `COPY`/`ACTION`, so more than 100 `vpython3.exe` processes run at once against `vpython-root.0\store`. 4. When `angle_commit_id` runs inside that burst, `cipkg` fails to reference the venv package (inferred: lock/reference contention): ``` failed to generate venv derivation: failed to reference the package: vpython_requirements+6a6r820h3nqlaqp6gjqd7r2ecc: package does not exist ``` **Why it passes ~84% of the time:** it depends on whether `angle_commit_id` gets scheduled during the burst. In the failing sub-build it ran at step `[260/10139]` with `peak_vpython_procs=101`. Passing sub-builds ran it after the burst drained (`[1302/10053]`, 4 processes) or finished it early (`[335/9855]`). **Why it started now:** unknown. It spans the whole baseline window. ## Proof of root cause (before the fix) | Build | Result | What to look for | |---|---|---| | [10993](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/10993/overview) ([log](https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8668651665918817921/+/u/build_android_profile_arm64/stdout)) | failed | `[DEFLAKE_PROBE]` logs `peak_vpython_procs=101`; step `[260/10139]` fails with `vpython_requirements+6a6r820h3nqlaqp6gjqd7r2ecc: package does not exist` | | [10993](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/10993/overview) ([log](https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8668651665918817873/+/u/build_android_release_arm64/stdout)) | passed (control) | `[DEFLAKE_PROBE]` logs `vp_samples=[87, 4, 4, 4, 4, 4]`; `angle_commit_id` runs at `[1302/10053]` after the burst drains | | [10993](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/10993/overview) ([log](https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8668651665918818001/+/u/build_android_debug_arm64/stdout)) | passed (control) | `[DEFLAKE_PROBE]` logs `peak_vpython_procs=116 angle_commit_h_ms=2619`; `angle_commit_id` finishes at `[335/9855]` | ## The fix This removes `vpython3` from the build graph entirely. Every GN action now runs `../../flutter/third_party/cpython3/bin/python3`, a plain CPython 3.11.9 from CIPD (`infra/3pp/tools/cpython3`, the same version Chromium pins). There's no virtualenv, no spec lookup, and no shared store. It also stays independent of whatever `python3` is on a developer's `PATH`, which was the reason for switching to `vpython3` in flutter-team-archive/buildroot#590. Pieces that come with it: - **GN roll** `81b24e01531e` → `f9eca75ae554`. The old GN [treats `script_executable` as a literal path](https://gn.googlesource.com/gn/+/81b24e01531ecf0eff12ec9359a555ec3944ec4e/src/gn/setup.cc#842). Support for `//` paths landed in [gn@4a060c55dcc5](https://gn.googlesource.com/gn/+/4a060c55dcc5380837a8684949b74400e929b85e). - **`gn format`**: the new GN rewraps comments and adds blank lines in 49 `.gn` files under `engine/src/flutter`. No semantic changes. - **License checker**: `licenses_cpp` [crawls every non-git `DEPS` directory](https://github.com/flutter/flutter/blob/8274c72edd454f28f044908463289f7976b270af/engine/src/flutter/tools/licenses_cpp/src/license_checker.cc#L516-L548), so I excluded `flutter/third_party/cpython3`. After pulling this, you need to run `gclient sync`. ## Rejected alternatives | Alternative | Why not (TL;DR) | Evidence | |---|---|---| | `script_executable = "python3"` (PR 193954) | Fixes the flake (64/64 green) but local builds then depend on `PATH` order again | `history`: [buildroot 590](flutter-team-archive/buildroot#590), [issue 108122](flutter#108122 (comment)) | | Roll GN to tip (Chromium's `0817afa57742`) | Turns on `check_includes_strict` by default; `gn gen --check` fails on every engine config | `constraint`: [gn@526295467bd1](https://gn.googlesource.com/gn/+/526295467bd18f5f8d9cb11f03a1c56cb40b7b28) | | Add a root `engine/src/.vpython3` spec | `vpython3` hits `angle/vpython.toml` first when walking up from `commit_id.py` | `constraint`: [`angle/BUILD.gn`](https://flutter.googlesource.com/third_party/angle/+/a8d74ca3e5e9e4ffa241330ceedcbe302443e472/BUILD.gn#950) | | Keep `vpython3` and pre-warm `angle/vpython.toml` | Still spawns 100+ wrappers per build and installs 80+ unused wheels | `history`: [issue 88719](flutter#88719), [buildroot 507](flutter-team-archive/buildroot#507) | <details><summary>Details and evidence</summary> **`python3` from `PATH`.** flutter#193954 verified 64/64 green with `script_executable = "python3"`. But `.gn` moved from `python3` to `vpython3` in [buildroot 590](flutter-team-archive/buildroot#590) so workstations wouldn't pick up a broken system `python3` or the Windows Store stub ahead of `depot_tools` ([issue 108122](flutter#108122 (comment))). A pinned `cpython3` keeps that guarantee without `vpython3`. **GN tip.** Chromium's pin includes [gn@526295467bd1](https://gn.googlesource.com/gn/+/526295467bd18f5f8d9cb11f03a1c56cb40b7b28) "Enable check_includes_strict by default". Running `flutter/tools/gn` with it fails `gen --check` on host, Android, web, and Fuchsia configs with `Public headers cannot include private dependencies` and `Can't include this header from here`. `f9eca75ae554` is its parent. Whoever rolls GN next will have to either set `check_includes_strict = false` or fix those includes. **Root `.vpython3` / pre-warming.** `vpython3` resolves the nearest spec walking up from the script, and [`angle_commit_id`](https://flutter.googlesource.com/third_party/angle/+/a8d74ca3e5e9e4ffa241330ceedcbe302443e472/BUILD.gn#950) lives under `flutter/third_party/angle/`. Pre-warming still runs every Windows `COPY` through `vpython3.exe`, and `vpython` cache flakes on Windows are why [buildroot 507](flutter-team-archive/buildroot#507) reverted the first move to `vpython3` ([issue 88719](flutter#88719)). </details> ## Proof of fix (after the fix) | Commit | Builds | Result | What to look for | |---|---|---|---| | [`d44d28f3df7`](mdebbar@d44d28f) (`cpython3` + GN roll) | [11360](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11360/overview)–[11369](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11369/overview) | 10/10 green | all `SUCCESS` | | [`f6c011ba36e`](mdebbar@f6c011b) (this PR's diff) | [11371](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11371/overview)–[11424](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11424/overview) | 42/42 Windows green | 39 `SUCCESS`; [11376](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11376/overview), [11378](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11378/overview), [11389](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11389/overview) are `wasm_*` 60m task timeouts after slow `Mount caches` (same as prod [4148](https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20local_engine_builds/4148/overview)) | If the fix did nothing, 52/52 green Windows sub-builds would have probability (1 − 0.16)^52 ≈ 1.2 × 10^-4. Since `script_executable` only points at `//flutter/third_party/cpython3/bin/python3`, every green Windows sub-build ran its actions on `cpython3`. One build each of `windows_unopt`, `windows_host_engine`, `windows_arm_host_engine`, `windows_host_engine_test`, `mac_unopt`, `mac_host_engine`, `mac_ios_engine`, `linux_unopt`, `linux_host_engine`, `linux_arm_host_engine`, `linux_web_engine`, `linux_fuchsia`, `linux_android_aot_engine`, `linux_clang_tidy` and `linux_license` (among others) also passed on these commits. <details><summary>All 52 verification builds</summary> [11360](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11360/overview), [11361](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11361/overview), [11362](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11362/overview), [11363](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11363/overview), [11364](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11364/overview), [11365](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11365/overview), [11366](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11366/overview), [11367](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11367/overview), [11368](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11368/overview), [11369](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11369/overview), [11371](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11371/overview), [11372](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11372/overview), [11373](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11373/overview), [11374](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11374/overview), [11375](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11375/overview), [11376](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11376/overview), [11377](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11377/overview), [11378](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11378/overview), [11379](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11379/overview), [11380](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11380/overview), [11386](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11386/overview), [11387](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11387/overview), [11388](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11388/overview), [11389](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11389/overview), [11390](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11390/overview), [11391](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11391/overview), [11392](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11392/overview), [11393](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11393/overview), [11394](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11394/overview), [11395](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11395/overview), [11396](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11396/overview), [11399](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11399/overview), [11400](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11400/overview), [11401](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11401/overview), [11402](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11402/overview), [11403](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11403/overview), [11404](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11404/overview), [11405](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11405/overview), [11406](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11406/overview), [11407](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11407/overview), [11408](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11408/overview), [11409](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11409/overview), [11415](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11415/overview), [11416](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11416/overview), [11417](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11417/overview), [11418](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11418/overview), [11419](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11419/overview), [11420](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11420/overview), [11421](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11421/overview), [11422](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11422/overview), [11423](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11423/overview), [11424](https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20local_engine_builds/11424/overview) </details> Investigation branch: https://github.com/mdebbar/flutter/tree/cpython3-flutter-flake-fix-2 Fixes flutter#193175
Depends on #194471
Linux local_engine_buildsfails on 16% of postsubmit runs when a Windows sub-build dies atACTION //flutter/third_party/angle:angle_commit_idwithFAILED: gen/angle/angle_commit.h.engine/src/.gnruns every GN action throughvpython3, and on Windows more than 100 concurrentvpython3.exeprocesses contend on the shared virtualenv store. This PR fetches a hermeticcpython3throughDEPSand pointsscript_executableat it, the same way Chromium and ANGLE do. This replaces #193954, which usedpython3fromPATH.The flake
display builds|windows/*failing onangle_commit.horvenv derivation, Oct 3 to Oct 1565b69d1e0dbExample postsubmit failures (
FAILUREindisplay builds|windows/*): 4322, 4314, 4310.Root cause
engine/src/.gnsetsscript_executable = "vpython3", so every GNaction()and the Windowstool("copy")run throughvpython3.exe.vpython3finds its spec by walking up from the script. Forangle/src/commit_id.py(stdlib only) it findsangle/vpython.toml, which declares 80+ test wheels.ninja -j 1000), the first ~340 steps are mostlyCOPY/ACTION, so more than 100vpython3.exeprocesses run at once againstvpython-root.0\store.angle_commit_idruns inside that burst,cipkgfails to reference the venv package (inferred: lock/reference contention):Why it passes ~84% of the time: it depends on whether
angle_commit_idgets scheduled during the burst. In the failing sub-build it ran at step[260/10139]withpeak_vpython_procs=101. Passing sub-builds ran it after the burst drained ([1302/10053], 4 processes) or finished it early ([335/9855]).Why it started now: unknown. It spans the whole baseline window.
Proof of root cause (before the fix)
[DEFLAKE_PROBE]logspeak_vpython_procs=101; step[260/10139]fails withvpython_requirements+6a6r820h3nqlaqp6gjqd7r2ecc: package does not exist[DEFLAKE_PROBE]logsvp_samples=[87, 4, 4, 4, 4, 4];angle_commit_idruns at[1302/10053]after the burst drains[DEFLAKE_PROBE]logspeak_vpython_procs=116 angle_commit_h_ms=2619;angle_commit_idfinishes at[335/9855]The fix
This removes
vpython3from the build graph entirely. Every GN action now runs../../flutter/third_party/cpython3/bin/python3, a plain CPython 3.11.9 from CIPD (infra/3pp/tools/cpython3, the same version Chromium pins). There's no virtualenv, no spec lookup, and no shared store. It also stays independent of whateverpython3is on a developer'sPATH, which was the reason for switching tovpython3in flutter-team-archive/buildroot#590.Pieces that come with it:
81b24e01531e→f9eca75ae554. The old GN treatsscript_executableas a literal path. Support for//paths landed in gn@4a060c55dcc5.gn format: the new GN rewraps comments and adds blank lines in 49.gnfiles underengine/src/flutter. No semantic changes.licenses_cppcrawls every non-gitDEPSdirectory, so I excludedflutter/third_party/cpython3.After pulling this, you need to run
gclient sync.Rejected alternatives
script_executable = "python3"(PR 193954)PATHorder againhistory: buildroot 590, issue 1081220817afa57742)check_includes_strictby default;gn gen --checkfails on every engine configconstraint: gn@526295467bd1engine/src/.vpython3specvpython3hitsangle/vpython.tomlfirst when walking up fromcommit_id.pyconstraint:angle/BUILD.gnvpython3and pre-warmangle/vpython.tomlhistory: issue 88719, buildroot 507Details and evidence
python3fromPATH. #193954 verified 64/64 green withscript_executable = "python3". But.gnmoved frompython3tovpython3in buildroot 590 so workstations wouldn't pick up a broken systempython3or the Windows Store stub ahead ofdepot_tools(issue 108122). A pinnedcpython3keeps that guarantee withoutvpython3.GN tip. Chromium's pin includes gn@526295467bd1 "Enable check_includes_strict by default". Running
flutter/tools/gnwith it failsgen --checkon host, Android, web, and Fuchsia configs withPublic headers cannot include private dependenciesandCan't include this header from here.f9eca75ae554is its parent. Whoever rolls GN next will have to either setcheck_includes_strict = falseor fix those includes.Root
.vpython3/ pre-warming.vpython3resolves the nearest spec walking up from the script, andangle_commit_idlives underflutter/third_party/angle/. Pre-warming still runs every WindowsCOPYthroughvpython3.exe, andvpythoncache flakes on Windows are why buildroot 507 reverted the first move tovpython3(issue 88719).Proof of fix (after the fix)
d44d28f3df7(cpython3+ GN roll)SUCCESSf6c011ba36e(this PR's diff)SUCCESS; 11376, 11378, 11389 arewasm_*60m task timeouts after slowMount caches(same as prod 4148)If the fix did nothing, 52/52 green Windows sub-builds would have probability (1 − 0.16)^52 ≈ 1.2 × 10^-4.
Since
script_executableonly points at//flutter/third_party/cpython3/bin/python3, every green Windows sub-build ran its actions oncpython3. One build each ofwindows_unopt,windows_host_engine,windows_arm_host_engine,windows_host_engine_test,mac_unopt,mac_host_engine,mac_ios_engine,linux_unopt,linux_host_engine,linux_arm_host_engine,linux_web_engine,linux_fuchsia,linux_android_aot_engine,linux_clang_tidyandlinux_license(among others) also passed on these commits.All 52 verification builds
11360, 11361, 11362, 11363, 11364, 11365, 11366, 11367, 11368, 11369, 11371, 11372, 11373, 11374, 11375, 11376, 11377, 11378, 11379, 11380, 11386, 11387, 11388, 11389, 11390, 11391, 11392, 11393, 11394, 11395, 11396, 11399, 11400, 11401, 11402, 11403, 11404, 11405, 11406, 11407, 11408, 11409, 11415, 11416, 11417, 11418, 11419, 11420, 11421, 11422, 11423, 11424
Investigation branch: https://github.com/mdebbar/flutter/tree/cpython3-flutter-flake-fix-2
Fixes #193175