Skip to content

Commit bab986b

Browse files
committed
CI: Flutter's fix for its tool hanging on a simulator, fitted to 3.47.2
The ios workflow's simulator step hung three times on 2026-10-24 and 2026-10-25 (on 91eced2, 2fe6d08 and c1f0e6b), each time until its 25-minute limit, the Flutter tool's last line "Waiting for VM Service port to be available..." and the app idle on the simulator. The tool learns the address of the app's Dart VM service from the one line the app logs it in, through a `log stream` it starts as it launches the app, and waits for it with no limit (startApp in packages/flutter_tools/lib/src/ios/simulators.dart). In 3.47.2 nothing waits for that stream to be ready, so when it starts late the line is missed and the wait never ends. That is flutter/flutter#181771, which Flutter fixed in flutter/flutter#193142 (c3ed85ef), in no release yet: not 3.47.8, the latest stable. third_party/flutter/simulator_log_stream.patch is that fix, fitted to 3.47.2, with its tests: one line of context differs, and the tests' simulator is built without the cpuArch argument 3.47.2 does not take. On 3.47.2 with only its tests applied, the two that wait for the log stream fail, the app launched before the stream printed anything; with the fix, all 53 of the simulator tests pass. The ios workflow applies it to the Flutter it sets up, empties the tool's stamp so that the flutter command builds its tool again from the patched source, and checks that the tool it built has the fix. Run on the 3.47.2 release archive as flutter-action installs it, with no .dart_tool, so that the rebuild's pub upgrade makes the package config: the tool builds in about 30 s, Flutter still reports 3.47.2 on stable and pub still sees 3.47.2, and a second run, on a Flutter that has the fix already, passes too. The step fails if the tool is not built again, if the fix is not applied, or if the patch does not fit: 3 of 3 mutants caught. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W92ERJ2vuziEpghjrqPe5w
1 parent c1f0e6b commit bab986b

6 files changed

Lines changed: 464 additions & 3 deletions

File tree

‎.github/workflows/ios.yml‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ on:
2525
- service/functions/deployment.mjs
2626
- packages/deal/**
2727
- packages/table/lib/src/schnorr_native*
28+
- third_party/flutter/**
2829
push:
2930
branches: [main]
3031
paths:
@@ -39,6 +40,7 @@ on:
3940
- service/functions/deployment.mjs
4041
- packages/deal/**
4142
- packages/table/lib/src/schnorr_native*
43+
- third_party/flutter/**
4244

4345
permissions:
4446
contents: read
@@ -58,6 +60,22 @@ jobs:
5860
channel: stable
5961
flutter-version: 3.47.2
6062
cache: true
63+
# 3.47.2 launches an app on a simulator before the log stream it
64+
# reads the app's VM service address from is ready, and when the
65+
# stream starts late it waits for that address with no end
66+
# (third_party/flutter/README.md). Once the pinned Flutter carries
67+
# the fix, this step and that folder go.
68+
- name: Flutter's tool, with its fix for a simulator's log stream (third_party/flutter)
69+
run: |
70+
cd "$FLUTTER_ROOT"
71+
fix="$GITHUB_WORKSPACE/third_party/flutter/simulator_log_stream.patch"
72+
# A Flutter restored from the cache may have the fix already.
73+
git apply --reverse --check "$fix" 2> /dev/null || git apply "$fix"
74+
# An empty stamp has the flutter command build its tool again,
75+
# from the patched source, before it runs.
76+
: > bin/cache/flutter_tools.stamp
77+
flutter --version
78+
grep -q 'The iOS simulator log stream did not start' bin/cache/flutter_tools.snapshot
6179
- uses: dtolnay/rust-toolchain@e2a55d2ffb04f378e9626c28d38b36d230d1e12f # master
6280
with:
6381
toolchain: 1.97.0
@@ -71,9 +89,11 @@ jobs:
7189
run: crypto/build_ios.sh
7290
- name: On a simulator (the libraries loaded as the app loads them, and checked)
7391
id: simulator
74-
# A run that passes takes about 9 minutes. One that hangs, as two
75-
# have once the app was built, is stopped well inside the job's
76-
# hour, so that the step after it can say where it was.
92+
# A run that passes takes about 9 minutes. One that hangs is
93+
# stopped well inside the job's hour, so that the step after it
94+
# can say where it was. The three it caught before the fix in
95+
# third_party/flutter were the tool waiting for the VM service's
96+
# address.
7797
timeout-minutes: 25
7898
run: |
7999
udid=$(xcrun simctl list devices available -j | python3 -c '

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,7 @@ its own licence beside it:
8080
of Dirty, Naughty, Obscene, and Otherwise Bad Words, by Shutterstock
8181
and its contributors. CC BY 4.0; how Open Hearts reads them is in
8282
that folder's README.
83+
- **Flutter's fix for a simulator's log stream** (`third_party/flutter/`):
84+
from flutter/flutter#193142, fitted to Flutter 3.47.2, which the `ios`
85+
workflow applies to the Flutter it builds with until a release
86+
carries it. BSD-3-Clause; what it fixes is in that folder's README.

‎docs/reference/test-suites.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ One job, `ios`, on macOS. It runs when started by hand, and on pull requests and
164164

165165
| Step | What it checks |
166166
|---|---|
167+
| `third_party/flutter/simulator_log_stream.patch`, applied to the Flutter it sets up, and the tool built again | Nothing itself. It is Flutter's fix for the tool waiting with no end on a simulator, which no release carries yet (`third_party/flutter/README.md`). It fails if the patch no longer applies, or the tool built again does not have it. |
167168
| `crypto/build_ios.sh` | The deal and Schnorr libraries build as XCFrameworks. |
168169
| `flutter test integration_test/native_libs_test.dart` on a simulator, once it has booted, for at most 25 minutes | The libraries load as the app loads them (`app/integration_test/native_libs_test.dart`). When it fails or hangs, the next step prints the end of the Flutter tool's log, the simulator's state, a sample of the app's threads, and the app's log on the simulator. |
169170
| `flutter build ios --release --no-codesign`, without the service key | The release build is refused (`app/ios/release_check.sh`). |

‎third_party/flutter/LICENSE‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Copyright 2014 The Flutter Authors. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without modification,
4+
are permitted provided that the following conditions are met:
5+
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above
9+
copyright notice, this list of conditions and the following
10+
disclaimer in the documentation and/or other materials provided
11+
with the distribution.
12+
* Neither the name of Google Inc. nor the names of its
13+
contributors may be used to endorse or promote products derived
14+
from this software without specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

‎third_party/flutter/README.md‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Flutter's fix for a simulator's log stream
2+
3+
`simulator_log_stream.patch` is Flutter's fix for
4+
[flutter/flutter#181771](https://github.com/flutter/flutter/issues/181771),
5+
from [flutter/flutter#193142](https://github.com/flutter/flutter/pull/193142),
6+
merged to Flutter's master branch as
7+
`c3ed85ef987759ee54a6bce275490cde2a238dc1`, fitted to Flutter 3.47.2, the
8+
version CI pins. No release carries it yet; 3.47.8 does not. It is licensed
9+
under Flutter's BSD 3-Clause licence, in `LICENSE`.
10+
11+
## What it fixes
12+
13+
On an iOS simulator, the Flutter tool reads the address of the app's Dart
14+
VM service from the simulator's log, through a `log stream` it starts as it
15+
launches the app. In 3.47.2 nothing waits for that stream to be ready, so
16+
when it starts late it misses the one line the app gives the address in,
17+
and the tool then waits for the address with no end. The `ios` workflow's
18+
simulator step hung that way three times on 2026-10-24 and 2026-10-25, each
19+
time at "Waiting for VM Service port to be available...", until its
20+
25-minute limit.
21+
22+
With the fix, the tool launches the app only once the stream has printed
23+
its first line, or has exited. After 30 seconds without either, it says so
24+
and goes on waiting.
25+
26+
## How it is used
27+
28+
`.github/workflows/ios.yml` applies it to the Flutter it sets up, and has
29+
the `flutter` command build its tool again from the patched source, as it
30+
does after any change to that source. Nothing else uses it. It changes
31+
only how the tool launches an app on a simulator, so none of it is in any
32+
app the tool builds.
33+
34+
## What was fitted
35+
36+
The change is Flutter's, line for line, with its tests. Two things differ,
37+
because 3.47.2 is older than the branch the fix was made on: one line of
38+
context above the first change, and the tests' simulator, built without
39+
the `cpuArch` argument that 3.47.2's simulator does not take.
40+
41+
To check it, from this repository's root, with `FLUTTER` the path of a
42+
checkout of Flutter 3.47.2:
43+
44+
```bash
45+
git -C "$FLUTTER" apply "$PWD/third_party/flutter/simulator_log_stream.patch"
46+
cd "$FLUTTER/packages/flutter_tools"
47+
../../bin/cache/dart-sdk/bin/dart pub get
48+
../../bin/cache/dart-sdk/bin/dart test test/general.shard/ios/simulators_test.dart
49+
```
50+
51+
All 53 tests pass. With only the patch's tests applied, the two that wait
52+
for the log stream fail: the app is launched before the stream has printed
53+
anything.
54+
55+
## When to remove it
56+
57+
Once CI pins a Flutter that carries the fix, delete this folder and the
58+
step in `.github/workflows/ios.yml` that applies it. A Flutter carries it
59+
when, in a checkout of it, `$FLUTTER/packages/flutter_tools/lib/src/ios/simulators.dart`
60+
says "The iOS simulator log stream did not start". The step fails if the
61+
patch no longer applies, or the tool built again does not have it.

0 commit comments

Comments
 (0)