Skip to content

"flutter daemon" leaves orphaned "xcdevice observe" processes around after being terminated #73859

@DanTup

Description

@DanTup

I can't repro this from the terminal (though that uses SIGINT on Ctrl+C and we generally), but from VS Code (which uses SIGTERM for all of its spawned processes) or the script below, the device daemon leaves behind some orphaned xcdevice proceses.

The script spawns the daemon, waits 10 seconds, then calls .kill(). After it completes, a /Applications/Xcode.app/Contents/Developer/usr/bin/xcdevice observe --both process remains. If I open/close lots of projects in VS Code, they will build up.

I'm testing with the latest master branch.

import 'dart:convert';
import 'dart:io';

Future<void> main(List<String> arguments) async {
  print('Spawning...');
  final proc = await Process.start('flutter', ['daemon']);
  proc.stderr.transform(utf8.decoder).listen(print);
  proc.stdout.transform(utf8.decoder).listen(print);
  await Future.delayed(const Duration(seconds: 1));

  print('Enabling devices...');
  proc.stdin.writeln('[{"id":"2","method":"device.enable"}]');
  await Future.delayed(const Duration(seconds: 10));

  print('Terminating...');
  proc.kill();

  print('Done!');
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 3.19Found to occur in 3.19found in release: 3.20Found to occur in 3.20has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyplatform-macBuilding on or for macOS specificallyt: xcode"xcodebuild" on iOS and general Xcode project managementteam-iosOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions