[Inspector] Infinite loading after a hot restart
I was running into frequent infinite loading with my project. It usually happens after a hot restart.
To reproduce with my project:
- Run
main.dart. - Open the inspector in the side panel or the web.
- After being loaded completely, trigger a hot restart.
- 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.
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
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!
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.
Hi @AlexV525 - would you be able to share the output of debugDumpApp for the app this reproduces on? Thanks!
Hi @AlexV525 - a few other things that could help us diagnose this.
- I see you have "Show implementation widgets" toggled on. Do you also run into this when "Show implementation widgets" is toggled off?
-
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?
-
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 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.
Running into this again for an unknown reason.
would you be able to share the output of
debugDumpAppfor the app this reproduces on? Thanks!
> debugDumpApp()
flutter: WidgetsFlutterBinding - DEBUG MODE
flutter: <no tree currently mounted>
flutter:
- null
I see you have "Show implementation widgets" toggled on. Do you also run into this when "Show implementation widgets" is toggled off?
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.
- 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
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!
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).
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).
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.
It keeps repro but in a relatively low frequency. I'm still trying to dig something out...