Skip to content

flutter test integration tests hang at teardown — _ddsLauncher.shutdown() is fire-and-forget with no timeout (sibling of #187785) #187984

Description

@chaudharydeepanshu

Steps to reproduce

  1. On a CPU-starved CI runner (e.g. GitHub Actions macos-15-intel, where the Android emulator falls back to the SwiftShader software GPU and qemu pins ~200% CPU on the 4 cores), boot an Android emulator.
  2. Run an integration test suite against it:
    flutter test integration_test/your_test.dart
  3. All tests pass, then flutter test does not exit. The job hangs until CI cancels it at its timeout.

This looks like a sibling of #187785 in the DDS shutdown path. #187876 added timeouts to the adb stopApp / uninstallApp teardown steps, but DDS shutdown is still un-timed.

Expected results

After the tests finish, flutter test shuts DDS down and exits.

Actual results

The process hangs. During the hang, ps shows the dart development-service (DDS) process as the only remaining child of the dartvm, sitting at 0% CPU. It never terminates, so flutter test waits on it indefinitely.

Looking at the source, DDS shutdown is fire-and-forget: it isn't awaited, and there's no timeout or forced kill. On a CPU-starved runner the DDS subprocess doesn't get scheduled to exit, so it lingers.

integration_test_device.dart, dispose():

await device.dispose();
_ddsLauncher.shutdown();   // not awaited
_finished.complete();

base/dds.dart:

void shutdown() => _ddsInstance?.shutdown();   // returns void, the Future is dropped

One possible fix, in the shape of #187876: have shutdown() return the Future, await it in dispose() with a timeout, and force-terminate the subprocess if it doesn't exit in time.

--no-dds doesn't help on current stable: the default integration-test golden comparator (VmServiceProxyGoldenFileComparator) needs DDS, so --no-dds makes its streamListen fail with -32602 invalid 'streamId' and adds a spurious loading … (failed) line.

Code sample

Code sample
// integration_test/minimal_test.dart
// Any integration test triggers it; the hang is in teardown, after the tests pass.
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  testWidgets('trivial', (tester) async {
    expect(1 + 1, 2);
  });
}

Run with flutter test integration_test/minimal_test.dart against a SwiftShader (no host GPU) Android emulator.

Screenshots or Video

No response

Logs

Logs
✅ trivial                                   # last test passes
[ then the run hangs; ps during the hang: ]

dartvm 80531
  └─ dart development-service --vm-service-uri=http://127.0.0.1:.../ --serve-devtools ...   (0.0% CPU, never exits)

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.44.1, on macOS 15.7.7 24G720 darwin-x64, locale en) [5.4s]
    • Flutter version 3.44.1 on channel stable at /Users/runner/.fvm_cache/versions/3.44.1
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 924134a44c (2 weeks ago), 2026-05-29 12:13:22 -0400
    • Engine revision c416acfeb8
    • Dart version 3.12.1
    • DevTools version 2.57.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
[✓] Android toolchain - develop for Android devices (Android SDK version 37.0.0) [12.1s]
    • Android SDK at /Users/runner/Library/Android/sdk
    • Emulator version 36.6.11.0 (build_id 15507667) (CL:N/A)
    • Platform android-37.0, build-tools 37.0.0
    • Java version OpenJDK Runtime Environment Temurin-17.0.19+10 (build 17.0.19+10)
    • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [13.2s]
    • Xcode at /Applications/Xcode_16.4.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2
[✓] Chrome - develop for the web [31ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Connected device (3 available) [18.5s]
    • Android ATD built for x86 64 (mobile) • emulator-5554 • android-x64    • Android 11 (API 30) (emulator)
    • macOS (desktop)                       • macos         • darwin-x64     • macOS 15.7.7 24G720 darwin-x64
    • Chrome (web)                          • chrome        • web-javascript • Google Chrome 149.0.7827.103
[✓] Network resources [474ms]
    • All expected network resources are available.
• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our testshas reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions