Skip to content

Commit

Permalink
add print traces to reload isolate resume logic (#147997)
Browse files Browse the repository at this point in the history
In service of #146879 and #145812.

This PR adds some more traces to help us figure out where we are getting blocked. See #146879 (comment) for more context.
  • Loading branch information
andrewkolos committed May 8, 2024
1 parent 39d8492 commit 2cfae14
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/flutter_tools/lib/src/run_hot.dart
Expand Up @@ -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
Expand All @@ -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.');
}));
}

Expand Down Expand Up @@ -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)}.');
Expand Down

0 comments on commit 2cfae14

Please sign in to comment.