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
163.15k stars 26.85k forks source link

[flutter_tools] Unexpected null value in AppInspector.jsEvaluate in dwds #126362

Open christopherfujino opened 1 year ago

christopherfujino commented 1 year ago

Command flutter run beta/3.10.0-1.5.pre

RPCError: ext.flutter.debugDumpFocusTree: (-32603) ext.flutter.debugDumpFocusTree: Unexpected error from chrome devtools:text: Uncaught (in promise)exception:  preview: null  description: null  type: string  value: Unexpected null value.attempted JS eval: `require("dart_sdk").developer.invokeExtension(    "ext.flutter.debugDumpFocusTree", JSON.stringify({}));`#0      handleErrorIfPresent (package:dwds/src/utilities/server.dart:91:5)#1      getResultOrHandleError (package:dwds/src/utilities/server.dart:105:3)#2      AppInspector.jsEvaluate (package:dwds/src/debugging/inspector.dart:346:20)<asynchronous suspension>#3      StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:124:15)<asynchronous suspension>
at new _OutstandingRequest(vm_service.dart:1822)
at VmService._call(vm_service.dart:2366)
at VmService.callServiceExtension(vm_service.dart:2337)
at FlutterVmService._checkedCallServiceExtension(vmservice.dart:885)
at FlutterVmService.invokeFlutterExtensionRpcRaw(vmservice.dart:904)
at FlutterVmService.flutterDebugDumpFocusTree(vmservice.dart:649)
at ResidentHandlers.debugDumpFocusTree(resident_runner.dart:762)
at <asynchronous gap>(async)
at TerminalHandler.processTerminalInput(resident_runner.dart:1821)
at <asynchronous gap>(async)
christopherfujino commented 1 year ago

FYI @elliette, this only affected 1 client.

yjbanov commented 1 year ago

@elliette agreed to triage in an offline discussion.

elliette commented 1 year ago

I don't think we should be throwing an exception when JS evaluation happens (or if we do, we should catch it in DWDS). Will open a PR for that.

elliette commented 1 year ago

Ah I think I know how this was triggered, although I can't reproduce it myself (no exception is thrown / Flutter does not crash).

Looks like recently a command was added to dump the focus tree into your terminal window: https://github.com/flutter/flutter/pull/123473

So you can start an app: flutter run -d chrome Then hit "f" to dump the focus tree. This calls the VM service callServiceExtensionMethod: https://github.com/flutter/flutter/blob/5451ea6e8f9ab4d39bd066d962a92a75f72c84f9/packages/flutter_tools/lib/src/vmservice.dart#L924

It's expected that clients will catch any errors thrown from by the VM Service (or in this case, DWDS). That's what we do in DevTools for example. I can update DWDS to throw an RPCError with the internal error code, but flutter_tools will still need to be updated to handle it.

@christopherfujino WDYT?

elliette commented 1 year ago

Also downgrading the priority since this isn't reproducible, and only affected 1 client.

flutter-triage-bot[bot] commented 8 months ago

This issue is assigned to @elliette but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

flutter-triage-bot[bot] commented 8 months ago

This issue is assigned to @elliette but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

flutter-triage-bot[bot] commented 8 months ago

This issue is assigned to @elliette but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

flutter-triage-bot[bot] commented 8 months ago

This issue is assigned to @elliette but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

flutter-triage-bot[bot] commented 8 months ago

This issue is assigned to @elliette but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

elliette commented 8 months ago

CC @christopherfujino I'm unassigning myself and handing this back to you to triage. After https://github.com/dart-lang/webdev/pull/2144, DWDS is now throwing an RPC.kInternalError. I think Flutter tools should catch the error instead of rethrowing (see https://github.com/flutter/flutter/issues/126362#issuecomment-1562020890). Thanks!

christopherfujino commented 8 months ago

CC @christopherfujino I'm unassigning myself and handing this back to you to triage. After dart-lang/webdev#2144, DWDS is now throwing an RPC.kInternalError. I think Flutter tools should catch the error instead of rethrowing (see #126362 (comment)). Thanks!

SGTM

flutter-triage-bot[bot] commented 8 months ago

The triaged-web label is irrelevant if there is no team-web label or fyi-web label.