devtools icon indicating copy to clipboard operation
devtools copied to clipboard

[Inspector] Infinite loading after a hot restart

Open AlexV525 opened this issue 8 months ago • 2 comments

I was running into frequent infinite loading with my project. It usually happens after a hot restart.

To reproduce with my project:

  1. Run main.dart.
  2. Open the inspector in the side panel or the web.
  3. After being loaded completely, trigger a hot restart.
  4. The inspector starts infinite loading.

To stop it, I can only stop & rerun the entry point.

I can 100% reproduce this with a specific project, it doesn't seem to reproduce when I run with other projects.

Image


DevTools version: 2.40.3 IDE: IntelliJ-IDEA Connected Device: CPU / OS: arm64 (64 bit) android Connected app type: Flutter native (debug build) Dart Version: 3.6.2 Flutter Version: 3.27.4 / stable Framework / Engine: d8a9f9a52e / 82bd5b7209

AlexV525 avatar Apr 22 '25 03:04 AlexV525

Hi @AlexV525! Could you provide either the project that this occurs on, or a minimal repro where this occurs if you can't share the project? Thank you!

elliette avatar May 30 '25 23:05 elliette

Hi @elliette , I can still see this after upgraded Flutter 3.32, but the behavior is slightly different. Now the loading will persist on every start until I press the refresh button mamually. Unfortunately I believe I cannot share the project because it's an internal one. How can I find useful logs or debugging info? Maybe I can also debug to find the cause too.

AlexV525 avatar May 31 '25 00:05 AlexV525

Hi @AlexV525 - would you be able to share the output of debugDumpApp for the app this reproduces on? Thanks!

elliette avatar Jul 09 '25 19:07 elliette

Hi @AlexV525 - a few other things that could help us diagnose this.

  1. I see you have "Show implementation widgets" toggled on. Do you also run into this when "Show implementation widgets" is toggled off?
Image
  1. If you enable the legacy inspector, click on your app's root widget, navigate to the details view and trigger a hot restart, do you also run into this?

  2. Finally, could open up the Chrome DevTools console for Flutter DevTools in your browser and share any logs or errors you see?

Thank you!

elliette avatar Jul 18 '25 20:07 elliette

@elliette Thanks for keeping up.

I've tried all my projects with DevTools version 2.45.1 (likely bundled with Flutter 3.32) to find the reproducible behavior, and it seems to have gone regardless of the options I've switched.

I'm going to close the issue since it seems to be resolved. Thanks for your time.

AlexV525 avatar Jul 19 '25 00:07 AlexV525

Running into this again for an unknown reason.

would you be able to share the output of debugDumpApp for the app this reproduces on? Thanks!

> debugDumpApp()
flutter: WidgetsFlutterBinding - DEBUG MODE
flutter: <no tree currently mounted>
flutter: 
 - null
  1. I see you have "Show implementation widgets" toggled on. Do you also run into this when "Show implementation widgets" is toggled off?

  2. If you enable the legacy inspector, click on your app's root widget, navigate to the details view and trigger a hot restart, do you also run into this?

Yes.

  1. Finally, could open up the Chrome DevTools console for Flutter DevTools in your browser and share any logs or errors you see?
Attempting to load DevTools with canvaskit renderer.
flutter_bootstrap.js:3 Loading from existing service worker.
flutter_bootstrap.js:3 Service worker already active.
flutter_bootstrap.js:1 Injecting <script> tag. Using callback.
main.dart.js:49576 Version: 2.40.3, Renderer: canvaskit
main.dart.js:49576 Successfully connected to DTD at: ws://127.0.0.1:57035/zEK5eSzR6_M=
vm_service.dart:2168 DevTools log level changed to INFO
main.dart.js:49576 Attempted to call extension 'ext.flutter.inspector.structuredErrors', but no service with that name exists
vm_service.dart:2168 readyToResume: (106) Isolate must be paused
Image

AlexV525 avatar Jul 19 '25 03:07 AlexV525

The "no tree currently mounted" message is coming from here: https://github.com/flutter/flutter/blob/20788c07fcb8a0483e566f9b3261457b7fc49f01/packages/flutter/lib/src/widgets/binding.dart#L1591

The rootElement is attached to the tree in response to the runApp method, but from what I can tell it's not a synchronous operation. My guess is that there is some race condition here.

If you are still able to reproduce this, would you be able to share the logs you see when you hit this (you can find them in the DevTools logging view). This might help us diagnose what order things are being called to figure out where the race condition is.

Thank you!

elliette avatar Jul 24 '25 18:07 elliette

If you are still able to reproduce this, would you be able to share the logs you see when you hit this (you can find them in the DevTools logging view). This might help us diagnose what order things are being called to figure out where the race condition is.

@elliette The log does not seem helpful with the issue. It's the same as I can see in my IDE debugging console (even less).

Image

AlexV525 avatar Jul 28 '25 10:07 AlexV525

Thanks @AlexV525! The Choreographer "Skipped 104 frames!" log indicates this might be Android specific. Are you able to run your app against any other devices to see if this reproduces there?

Also, regarding the logs, I'm not seeing any Flutter logs in the logging panel. Could you make sure to update the filters to show all log levels, and include any logs from Flutter (see screenshots below).

Image Image

Again, thank you for your help, and sorry for all this back and forth! Since I can't reproduce this myself your responses here are very helpful for trying to diagnose what is happening here.

elliette avatar Jul 28 '25 16:07 elliette

It keeps repro but in a relatively low frequency. I'm still trying to dig something out...

AlexV525 avatar Aug 11 '25 14:08 AlexV525