flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
165k stars 27.19k forks source link

Exception in `flutter run` after using the `R` command #12669

Closed bwilkerson closed 6 years ago

bwilkerson commented 6 years ago

Steps to Reproduce

I am starting to learn a bit about Flutter and Flutter development by creating a simple calculator app. I used flutter run to run the app, and it was running in the Android simulator. I had used a sequence of R and r commands to see changes. I had stopped for a while to do other things and had left the app running. When I came back to it (about 2 hours later) I made some change and typed R to see them. That resulted in the following exception:

Performing full restart...                                
TimeoutException: Request to Dart VM Service timed out: _flutter.listViews({})
#0      VM.invokeRpcRaw (package:flutter_tools/src/vmservice.dart:736)
<asynchronous suspension>
#1      VM.invokeRpc (package:flutter_tools/src/vmservice.dart:749)
<asynchronous suspension>
#2      VM.refreshViews (package:flutter_tools/src/vmservice.dart:845)
<asynchronous suspension>
#3      FlutterDevice.refreshViews (package:flutter_tools/src/resident_runner.dart:71)
<asynchronous suspension>
#4      ResidentRunner.refreshViews (package:flutter_tools/src/resident_runner.dart:458)
<asynchronous suspension>
#5      HotRunner._restartFromSources (package:flutter_tools/src/run_hot.dart:344)
<asynchronous suspension>
#6      HotRunner.restart (package:flutter_tools/src/run_hot.dart:414)
<asynchronous suspension>
#7      HotRunner.handleTerminalCommand (package:flutter_tools/src/run_hot.dart:231)
<asynchronous suspension>
#8      ResidentRunner.processTerminalInput (package:flutter_tools/src/resident_runner.dart:721)
<asynchronous suspension>
#9      _rootRunUnary (dart:async/zone.dart:1128)
#10     _CustomZone.runUnary (dart:async/zone.dart:1012)
#11     _CustomZone.runUnaryGuarded (dart:async/zone.dart:909)
#12     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330)
#13     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257)
#14     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:379)
#15     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:254)
#16     _AsBroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:480)
#17     _rootRunUnary (dart:async/zone.dart:1128)
#18     _CustomZone.runUnary (dart:async/zone.dart:1012)
#19     _CustomZone.runUnaryGuarded (dart:async/zone.dart:909)
#20     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330)
#21     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257)
#22     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68)
#23     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15)
#24     _StringAdapterSink.add (dart:convert/string_conversion.dart:268)
#25     _SimpleAsciiDecoderSink.add (dart:convert/ascii.dart:296)
#26     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:86)
#27     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120)
#28     _rootRunUnary (dart:async/zone.dart:1128)
#29     _CustomZone.runUnary (dart:async/zone.dart:1012)
#30     _CustomZone.runUnaryGuarded (dart:async/zone.dart:909)
#31     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330)
#32     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257)
#33     _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:796)
#34     _StreamController._add (dart:async/stream_controller.dart:667)
#35     _StreamController.add (dart:async/stream_controller.dart:613)
#36     _Socket._onData (dart:io-patch/socket_patch.dart:1643)
#37     _rootRunUnary (dart:async/zone.dart:1132)
#38     _CustomZone.runUnary (dart:async/zone.dart:1012)
#39     _CustomZone.runUnaryGuarded (dart:async/zone.dart:909)
#40     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330)
#41     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257)
#42     _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:796)
#43     _StreamController._add (dart:async/stream_controller.dart:667)
#44     _StreamController.add (dart:async/stream_controller.dart:613)
#45     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1228)
#46     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:784)
#47     _microtaskLoop (dart:async/schedule_microtask.dart:41)
#48     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#49     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:99)
#50     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:152)

The Android simulator appears to be hung, but it would be good if flutter run could tell me this (and suggest remediation steps) rather than crash.

Logs

I let flutter run run for about 30 minutes, and all it produced was:

Showing Android SDK built for x86 logs:

Here is the output from flutter analyze:

Analyzing /Users/brianwilkerson/dart/calculator...
  error • The constructor returns type 'dynamic' that isn't of expected type 'Widget' at test/widget_test.dart:15:29 • strong_mode_invalid_cast_new_expr
  error • Undefined class 'MyApp' at test/widget_test.dart:15:33 • undefined_class
  hint • Unused import at test/widget_test.dart:10:8 • unused_import
3 issues found.
(Ran in 6.0s)

I used IntelliJ's rename refactoring to rename 'MyApp'. Server must have missed the reference in widget_test.dart, but that's a separate issue.

Flutter Doctor

Here is the output from flutter doctor:

[✓] Flutter (on Mac OS X 10.12.6 16G29, locale en-US, channel master)
    • Flutter at /Users/brianwilkerson/src/dart/flutter
    • Framework revision b07ea41954 (2 days ago), 2017-10-20 21:20:42 -0700
    • Engine revision 7c4142808c
    • Tools Dart version 1.25.0-dev.11.0

[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
    • Android SDK at /Users/brianwilkerson/Library/Android/sdk
    • Platform android-25, build-tools 25.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[-] iOS toolchain - develop for iOS devices (Xcode 8.3.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 8.3.3, Build version 8E3004b
    • ios-deploy 1.8.6
    ✗ ios-deploy out of date (1.9.2 is required). To upgrade:
        brew upgrade ios-deploy
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
        For more info, see https://flutter.io/platform-plugins
      To install:
        brew install cocoapods
        pod setup

[✓] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Community Edition (version 2017.2.5)
    • Flutter plugin version 18.1
    • Dart plugin version 172.4343.25

[-] IntelliJ IDEA Ultimate Edition (version 2017.1.3)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.io/intellij-setup/#installing-the-plugins

adb not responding
jason-simmons commented 6 years ago

A recent engine had a regression in hot restart. The latest engine on the master branch should fix this.

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.