mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Reintroduce verbose logging for hot reload flake (#152639)
Adds some logging to assist with troubleshooting https://github.com/flutter/flutter/issues/152220 (which is a reapperance of flake https://github.com/flutter/flutter/issues/146879) on CI. TL;DR [the tool sometimes never receives the `IsolateRunnable` event from the vm service after calling `_flutter.runInView`](https://github.com/flutter/flutter/issues/146879#issuecomment-2118629953).
This commit is contained in:
parent
d62069ff37
commit
535e88b092
@ -643,14 +643,6 @@ class HotRunner extends ResidentRunner {
|
||||
final Future<vm_service.Isolate?> reloadIsolate = device.vmService!
|
||||
.getIsolateOrNull(view.uiIsolate!.id!);
|
||||
operations.add(reloadIsolate.then((vm_service.Isolate? isolate) async {
|
||||
// TODO(andrewkolos): this race is meant to assist in debugging
|
||||
// https://github.com/flutter/flutter/issues/145812. When the issue
|
||||
// is resolved, this trace (and probably all others added by
|
||||
// the same PR) can be removed.
|
||||
globals.logger.printTrace(
|
||||
'Beginning of UI start paused handler. '
|
||||
'uiIsolate = $isolate; isolate.pauseEvent.kind = ${isolate?.pauseEvent!.kind}',
|
||||
);
|
||||
if ((isolate != null) && isPauseEvent(isolate.pauseEvent!.kind!)) {
|
||||
// The embedder requires that the isolate is unpaused, because the
|
||||
// runInView method requires interaction with dart engine APIs that
|
||||
@ -673,7 +665,6 @@ class HotRunner extends ResidentRunner {
|
||||
await Future.wait(breakpointAndExceptionRemoval);
|
||||
await device.vmService!.service.resume(view.uiIsolate!.id!);
|
||||
}
|
||||
globals.logger.printTrace('End of UI start paused handler.');
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -578,6 +578,25 @@ class FlutterVmService {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(andrewkolos): this is to assist in troubleshooting
|
||||
// https://github.com/flutter/flutter/issues/152220 and should be reverted
|
||||
// once this issue is resolved.
|
||||
final StreamSubscription<String> onReceiveSubscription = service.onReceive.listen(
|
||||
(String message) {
|
||||
globals.logger.printTrace(
|
||||
'runInView VM service onReceive listener received "$message"',
|
||||
);
|
||||
final dynamic messageAsJson = jsonDecode(message);
|
||||
// ignore: avoid_dynamic_calls -- Temporary code.
|
||||
final dynamic messageKind = messageAsJson['params']?['event']?['kind'];
|
||||
if (messageKind == 'IsolateRunnable') {
|
||||
globals.logger.printTrace(
|
||||
'Received IsolateRunnable event from onReceive.',
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
final Future<void> onRunnable = service.onIsolateEvent.firstWhere((vm_service.Event event) {
|
||||
return event.kind == vm_service.EventKind.kIsolateRunnable;
|
||||
});
|
||||
@ -590,6 +609,7 @@ class FlutterVmService {
|
||||
},
|
||||
);
|
||||
await onRunnable;
|
||||
await onReceiveSubscription.cancel();
|
||||
}
|
||||
|
||||
Future<String> flutterDebugDumpApp({
|
||||
|
@ -231,7 +231,7 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
testWithoutContext('runInView forwards arguments correctly', () async {
|
||||
testUsingContext('runInView forwards arguments correctly', () async {
|
||||
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
|
||||
requests: <VmServiceExpectation>[
|
||||
const FakeVmServiceRequest(method: 'streamListen', args: <String, Object>{
|
||||
|
Loading…
Reference in New Issue
Block a user