add print traces to reload isolate resume logic (#147997)

In service of https://github.com/flutter/flutter/issues/146879 and https://github.com/flutter/flutter/issues/145812.

This PR adds some more traces to help us figure out where we are getting blocked. See https://github.com/flutter/flutter/issues/146879#issuecomment-2101115534 for more context.
This commit is contained in:
Andrew Kolos 2024-05-08 12:57:57 -07:00 committed by GitHub
parent 39d8492fb8
commit 2cfae1431f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -646,6 +646,14 @@ 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
@ -668,6 +676,7 @@ 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.');
}));
}
@ -703,7 +712,7 @@ class HotRunner extends ResidentRunner {
}
}
await Future.wait(operations);
globals.printTrace('Finished waiting on operations.');
await _launchFromDevFS();
restartTimer.stop();
globals.printTrace('Hot restart performed in ${getElapsedAsMilliseconds(restartTimer.elapsed)}.');