Skip to content

Unable to initiate log reader for device warning is imprecise #155795

@andrewkolos

Description

@andrewkolos

#154903 documented a common tool crash in 3.24.2, where FlutterDevice.initLogReader will throw an RPCError if the HotRunner was unable to communicate with the VM (which can happen for a variety of reasons; e.g. the device is shutdown/disconnected).

#155049 adjusted this code to catch this error, discard it, and log a warning. However, the warning is vague and not useful for users:

Future<void> tryInitLogReader() async {
final vm_service.VM? vm = await vmService!.getVmGuarded();
if (vm == null) {
globals.printError(
'Unable to initiate log reader for device'
'${device?.name}, because the Flutter VM service connection '
'is closed.',
);
return;
}
final DeviceLogReader logReader = await device!.getLogReader(app: package);
logReader.appPid = vm.pid;
}

Imagine reading this as a user. You would probably be confused. What is a Flutter VM service? Does this mean I won't see any logs at all? Does it mean I might see extraneous logs from other processes on the device?

Another thing: upon going through the implementations of tryInitLogReader, I've realized that this codepath only affects Android and iOS. This means that this warning message would be complete noise to web and desktop app developers.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listteam-toolOwned by Flutter Tool teamtriaged-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