flutter / devtools

Performance tools for Flutter
https://flutter.dev/docs/development/tools/devtools/
BSD 3-Clause "New" or "Revised" License
1.59k stars 327 forks source link

After upgrade to flutter 2.10.0-1.0.pre.312, devtools fails to connect to the gallery app on Android emulator #3599

Closed polina-c closed 2 years ago

polina-c commented 2 years ago
Upgrading Flutter to 2.10.0-1.0.pre.312 from 2.10.0-1.0.pre.291

For macos:

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: NoSuchMethodError: The method 'getVMTimelineFlags' was called on null.
Receiver: null
Tried calling: getVMTimelineFlags()
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
#1      TimelineStreamManager._initStreams (package:devtools_app/src/performance/timeline_streams.dart:79:41)
#2      TimelineStreamManager.vmServiceOpened.<anonymous closure> (package:devtools_app/src/performance/timeline_streams.dart:140:15)
#3      TimelineStreamManager.vmServiceOpened.<anonymous closure> (package:devtools_app/src/performance/timeline_streams.dart:137:52)
#4      _rootRunUnary (dart:async/zone.dart:1434:47)
#5      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
<asynchronous suspension>

flutter: [ERROR]: WebSocketChannelException: WebSocketChannelException: SocketException: Connection refused (OS Error: Connection refused, errno = 61), address = 127.0.0.1, port = 54442

For web:

Timed out trying to fetch flutter version from `ConnectedApp.initializeValues`.
TypeError: Cannot read properties of null (reading 'getVMTimelineFlags')
    at timeline_streams.TimelineStreamManager.new._initStreams
    (http://localhost:54794/packages/devtools_app/src/vm_developer/vm_statistics_view_controller.dart.lib.js:93202:49)
    at _initStreams.next (<anonymous>)
    at runBody (http://localhost:54794/dart_sdk.js:43013:34)
    at Object._async [as async] (http://localhost:54794/dart_sdk.js:43044:7)
    at timeline_streams.TimelineStreamManager.new.[_initStreams]
    (http://localhost:54794/packages/devtools_app/src/vm_developer/vm_statistics_view_controller.dart.lib.js:93200:20)
    at timeline_streams.TimelineStreamManager.new.<anonymous>
    (http://localhost:54794/packages/devtools_app/src/vm_developer/vm_statistics_view_controller.dart.lib.js:93240:41)
    at Generator.next (<anonymous>)
    at runBody (http://localhost:54794/dart_sdk.js:43013:34)
    at Object._async [as async] (http://localhost:54794/dart_sdk.js:43044:7)
    at http://localhost:54794/packages/devtools_app/src/vm_developer/vm_statistics_view_controller.dart.lib.js:93238:92
    at _RootZone.runUnary (http://localhost:54794/dart_sdk.js:42849:58)
    at _FutureListener.then.handleValue (http://localhost:54794/dart_sdk.js:37417:29)
    at handleValueCallback (http://localhost:54794/dart_sdk.js:38020:49)
    at Function._propagateToListeners (http://localhost:54794/dart_sdk.js:38058:17)
    at _Future.new.[_completeWithValue] (http://localhost:54794/dart_sdk.js:37900:23)
    at async._AsyncCallbackEntry.new.callback (http://localhost:54794/dart_sdk.js:37923:35)
    at Object._microtaskLoop (http://localhost:54794/dart_sdk.js:43153:13)
    at _startMicrotaskLoop (http://localhost:54794/dart_sdk.js:43159:13)
    at http://localhost:54794/dart_sdk.js:38289:9
kenzieschmoll commented 2 years ago

I just tried to reproduce this. In my repro, the application crashed before DevTools threw this error. This makes sense because the error above indicates that the Vm Service is null, which happens when the app exits. Is this what you are seeing?

kenzieschmoll commented 2 years ago

I am getting this error in the console running flutter gallery:

Unhandled exception:
type 'DillSetterBuilder' is not a subtype of type 'SourceMemberBuilderImpl?' in type cast
#0      SourceLibraryBuilder.checkMemberConflicts.<anonymous closure>
(package:front_end/src/fasta/source/source_library_builder.dart:998:22)
#1      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:574:13)
#2      Scope.forEachLocalSetter (package:front_end/src/fasta/scope.dart:424:14)
#3      SourceLibraryBuilder.checkMemberConflicts (package:front_end/src/fasta/source/source_library_builder.dart:974:11)
#4      SourceLibraryBuilder.build (package:front_end/src/fasta/source/source_library_builder.dart:1057:5)
#5      IncrementalCompiler.compileExpression.<anonymous closure>
(package:front_end/src/fasta/incremental_compiler.dart:1817:20)
#6      IncrementalCompiler.compileExpression.<anonymous closure>
(package:front_end/src/fasta/incremental_compiler.dart:1668:39)
#7      CompilerContext.runInContext.<anonymous closure>.<anonymous closure>
(package:front_end/src/fasta/compiler_context.dart:118:46)
#8      new Future.sync (dart:async/future.dart:296:31)
#9      CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:118:19)
#10     _rootRun (dart:async/zone.dart:1426:13)
#11     _CustomZone.run (dart:async/zone.dart:1328:19)
#12     _runZoned (dart:async/zone.dart:1861:10)
#13     runZoned (dart:async/zone.dart:1783:10)
#14     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:117:12)
#15     IncrementalCompiler.compileExpression (package:front_end/src/fasta/incremental_compiler.dart:1668:26)
#16     IncrementalCompiler.compileExpression (package:vm/incremental_compiler.dart:218:23)
#17     FrontendCompiler.compileExpression
(file:///opt/s/w/ir/cache/builder/sdk/pkg/frontend_server/lib/frontend_server.dart:850:44)
#18     listenAndCompile.<anonymous closure>
(file:///opt/s/w/ir/cache/builder/sdk/pkg/frontend_server/lib/frontend_server.dart:1268:20)
#19     listenAndCompile.<anonymous closure>
(file:///opt/s/w/ir/cache/builder/sdk/pkg/frontend_server/lib/frontend_server.dart:1160:15)
#20     _RootZone.runUnaryGuarded (dart:async/zone.dart:1618:10)
#21     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#22     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#23     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63:11)
#24     _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)
#25     _StringAdapterSink.add (dart:convert/string_conversion.dart:238:11)
#26     _LineSplitterSink._addLines (dart:convert/line_splitter.dart:170:13)
#27     _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:145:5)
#28     StringConversionSinkMixin.add (dart:convert/string_conversion.dart:163:5)
#29     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111:24)
#30     _RootZone.runUnaryGuarded (dart:async/zone.dart:1618:10)
#31     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#32     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#33     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63:11)
#34     _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)
#35     _StringAdapterSink.add (dart:convert/string_conversion.dart:238:11)
#36     _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:243:7)
#37     _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:317:20)
#38     _Utf8ConversionSink.add (dart:convert/string_conversion.dart:310:5)
#39     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:72:18)
#40     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111:24)
#41     _RootZone.runUnaryGuarded (dart:async/zone.dart:1618:10)
#42     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#43     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#44     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
#45     _StreamController._add (dart:async/stream_controller.dart:648:7)
#46     _StreamController.add (dart:async/stream_controller.dart:596:5)
#47     _Socket._onData (dart:io-patch/socket_patch.dart:2314:41)
#48     _RootZone.runUnaryGuarded (dart:async/zone.dart:1618:10)
#49     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#50     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#51     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
#52     _StreamController._add (dart:async/stream_controller.dart:648:7)
#53     _StreamController.add (dart:async/stream_controller.dart:596:5)
#54     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1839:33)
#55     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1322:14)
#56     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#57     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
#58     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:122:13)
#59     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:193:5)
the Dart compiler exited unexpectedly.
the Dart compiler exited unexpectedly.

CC @bkonyi

bkonyi commented 2 years ago

Looks like a compiler crash. Maybe @alexmarkov can triage this.

polina-c commented 2 years ago

I just tried to reproduce this. In my repro, the application crashed before DevTools threw this error. This makes sense because the error above indicates that the Vm Service is null, which happens when the app exits. Is this what you are seeing?

Nope. The app starts successfully for me and only crashes when I try to connect.

kenzieschmoll commented 2 years ago

Confirmed this happens on flutter master (2.10.0-1.0.pre.314) but not on beta (2.10.0-0.3-pre)

alexmarkov commented 2 years ago

Stack trace in https://github.com/flutter/devtools/issues/3599#issuecomment-1023740373 looks like a front-end crash while compiling an expression for expression evaluation. /cc @johnniwinther

johnniwinther commented 2 years ago

@jensjoha Can you take a look at this?

jensjoha commented 2 years ago

I can't reproduce any of it. Can anyone provide a reproduction (step-by-step)?

kenzieschmoll commented 2 years ago

Repro steps:

  1. checkout flutter master (I was on 2.10.0-1.0.pre.314 when I reproduced this)).
  2. run flutter gallery flutter run
  3. run DevTools (from path/to/devtools/packages/devtools_app, run flutter run -d macos or -d linux if you're on linux. You can also run as a flutter web app with -d chrome if that is easier).
  4. Copy the Observatory URI printed at step 2 after running gallery into the Connect dialog in DevTools.
  5. Click "connect" and observe that the flutter gallery app crashes with the above error.
jensjoha commented 2 years ago

@kenzieschmoll reproduced, thanks!

k1ngjet3r commented 2 years ago

I was having the same issue here. My flutter app can launch without any issue, but when I tried to launch the DevTools, it just crush and having the similar error message.

The device I was using was Macbook Pro with M1 Pro chip and the flutter version was 2.10.0-1.0.pre.339, hope this will help!

Unhandled exception:
type 'DillSetterBuilder' is not a subtype of type 'SourceMemberBuilderImpl?' in type cast
#0      SourceLibraryBuilder.checkMemberConflicts.<anonymous closure> (package:front_end/src/fasta/source/source_library_builder.dart:998:22)
#1      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:574:13)
#2      Scope.forEachLocalSetter (package:front_end/src/fasta/scope.dart:424:14)
#3      SourceLibraryBuilder.checkMemberConflicts (package:front_end/src/fasta/source/source_library_builder.dart:974:11)
#4      SourceLibraryBuilder.build (package:front_end/src/fasta/source/source_library_builder.dart:1057:5)
#5      IncrementalCompiler.compileExpression.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:1817:20)
#6      IncrementalCompiler.compileExpression.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:1668:39)
#7      CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:118:46)
#8      new Future.sync (dart:async/future.dart:296:31)
#9      CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:118:19)
#10     _rootRun (dart:async/zone.dart:1426:13)
#11     _CustomZone.run (dart:async/zone.dart:1328:19)
#12     _runZoned (dart:async/zone.dart:1861:10)
#13     runZoned (dart:async/zone.dart:1783:10)
#14     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:117:12)
#15     IncrementalCompiler.compileExpression (package:front_end/src/fasta/incremental_compiler.dart:1668:26)

#16     IncrementalCompiler.compileExpression (package:vm/incremental_compiler.dart:218:23)
#17     FrontendCompiler.compileExpression (file:///opt/s/w/ir/cache/builder/sdk/pkg/frontend_server/lib/frontend_server.dart:850:44)
#18     listenAndCompile.<anonymous closure> (file:///opt/s/w/ir/cache/builder/sdk/pkg/frontend_server/lib/frontend_server.dart:1268:20)
#19     listenAndCompile.<anonymous closure> (file:///opt/s/w/ir/cache/builder/sdk/pkg/frontend_server/lib/frontend_server.dart:1160:15)
#20     _RootZone.runUnaryGuarded (dart:async/zone.dart:1618:10)
#21     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#22     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#23     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63:11)
#24     _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)
#25     _StringAdapterSink.add (dart:convert/string_conversion.dart:238:11)
#26     _LineSplitterSink._addLines (dart:convert/line_splitter.dart:170:13)
#27     _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:145:5)
#28     StringConversionSinkMixin.add (dart:convert/string_conversion.dart:163:5)
#29     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111:24)
#30     _RootZone.runUnaryGuarded (dart:async/zone.dart:1618:10)
#31     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#32     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#33     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63:11)
#34     _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)
#35     _StringAdapterSink.add (dart:convert/string_conversion.dart:238:11)
#36     _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:243:7)
#37     _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:317:20)
#38     _Utf8ConversionSink.add (dart:convert/string_conversion.dart:310:5)

#39     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:72:18)
#40     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111:24)
#41     _RootZone.runUnaryGuarded (dart:async/zone.dart:1618:10)
#42     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#43     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#44     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
#45     _StreamController._add (dart:async/stream_controller.dart:648:7)
#46     _StreamController.add (dart:async/stream_controller.dart:596:5)
#47     _Socket._onData (dart:io-patch/socket_patch.dart:2314:41)
#48     _RootZone.runUnaryGuarded (dart:async/zone.dart:1618:10)
#49     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#50     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#51     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)

#52     _StreamController._add (dart:async/stream_controller.dart:648:7)
#53     _StreamController.add (dart:async/stream_controller.dart:596:5)
#54     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1839:33)
#55     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1322:14)
#56     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#57     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
#58     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:122:13)
#59     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:193:5)

2
the Dart compiler exited unexpectedly.
isuruwe commented 2 years ago

මොන පරයද check කරන්නැතුව publish දාපු එකා

kenzieschmoll commented 2 years ago

I can confirm this issue is fixed with the latest flutter master.

abegehr commented 2 years ago

I'm seeing this on the latest Flutter version from the beta channel: 2.11.0-0.1.pre

[flutter] flutter doctor -v
[✓] Flutter (Channel beta, 2.11.0-0.1.pre, on macOS 12.3 21E5212f darwin-x64, locale en-DE)
    • Flutter version 2.11.0-0.1.pre at /Users/anton/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b101bfe32f (4 days ago), 2022-02-16 07:36:54 -0800
    • Engine revision e355993572
    • Dart version 2.17.0 (build 2.17.0-69.2.beta)
    • DevTools version 2.10.0-dev.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/anton/Library/Android/sdk
    • Platform android-32, build-tools 32.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
    • Xcode at /Applications/Xcode-beta.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.62.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.29.0

[✓] Connected device (2 available)
    • Anton’s iPhone (mobile) • 00008101-0002249636B8001E • ios            • iOS 15.4 19E5225g
    • Chrome (web)            • chrome                    • web-javascript • Google Chrome 98.0.4758.102
    ! Error: Anton’s iPhone is busy: Preparing the watch for development via Anton’s iPhone. Xcode will continue when Anton’s iPhone is finished. (code -10)
    ! Error: Anton’s iPad is not connected. Xcode will continue when Anton’s iPad is connected. (code -13)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
exit code 0
kenzieschmoll commented 2 years ago

See https://github.com/flutter/flutter/issues/97500#issuecomment-1044083031 for explanation. This issue is not present on the master branch of flutter, so the fix has already been landed upstream.

fzyzcjy commented 2 years ago

Is there any workarounds when using Flutter stable and want to use the devtools? The devtools are really helpful for developing and debugging the Flutter application. Thanks.

kenzieschmoll commented 2 years ago

Looks like your question was answered on https://github.com/flutter/flutter/issues/97500#issuecomment-1066478485. Let us know if you run into any more issues.

roiang commented 2 years ago

having trouble with the version of flutter 2.10.5 was using 2.8.1, now I can't run my app on any emulator or device not showing any error visible, it also ask me to upgrade my Xcode but I cant on my macbookAir I can only use chrome to emulate. why is this happening?