Skip to content

vm_service getInstances fails with null reference when invoked for TypeParameters #52893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
polina-c opened this issue Jul 9, 2023 · 6 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. pkg-vm-service

Comments

@polina-c
Copy link
Contributor

polina-c commented Jul 9, 2023

Dart code:

  var classes = await connection.service.getClassList(isolateId).map(
        (classRef) => _ItemInIsolate(
          itemId: classRef.id!,
          isolateId: isolateId,
          name: classRef.name,
        ),
      );


  for (final theClass in classes) {
    const pathLengthLimit = 10000000;
    print('requesting getInstances for ${theClass.name}');
    final instances = (await connection.service.getInstances(
          theClass.isolateId,
          theClass.itemId,
          pathLengthLimit,
        ))

Error:

Connecting to VM Service at ws://127.0.0.1:50630/kCipO3f91uk=/ws
requesting getInstances for Class
requesting getInstances for PatchClass
requesting getInstances for Function
requesting getInstances for TypeParameters
type 'Null' is not a subtype of type 'ObjRef'
dart:core                                       new List.from
package:vm_service/src/vm_service.dart 6594:17  new InstanceSet._fromJson
package:vm_service/src/vm_service.dart 6579:41  InstanceSet.parse
package:vm_service/src/vm_service.dart 70:25    createServiceObject
package:vm_service/src/vm_service.dart 2588:26  VmService._processResponse
package:vm_service/src/vm_service.dart 2567:7   VmService._processMessageStr
package:vm_service/src/vm_service.dart 2519:7   VmService._processMessage
flutter --version
Flutter 3.12.0-15.0.pre.57 • channel master • [email protected]:flutter/flutter.git
Framework • revision 3ec96a8a4a (8 hours ago) • 2023-07-09 08:57:27 -0400
Engine • revision 111051e4f5
Tools • Dart 3.1.0 (build 3.1.0-285.0.dev) • DevTools 2.25.0
@vsmenon vsmenon added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Jul 10, 2023
@a-siva a-siva added the vm-service The VM Service Protocol, both the specification and its implementation label Jul 26, 2023
@a-siva
Copy link
Contributor

a-siva commented Jul 26, 2023

//cc @derekxu16

@a-siva a-siva added pkg-vm-service and removed vm-service The VM Service Protocol, both the specification and its implementation labels Jul 27, 2023
@a-siva
Copy link
Contributor

a-siva commented Jul 28, 2023

TypeParameters are returned as _TypeParameters by the VM and in pkg:vm_service we don't account for that, see https://github.com/dart-lang/sdk/blob/main/pkg/vm_service/lib/src/vm_service.dart#L192

@bkonyi
Copy link
Contributor

bkonyi commented Jul 28, 2023

We should just go ahead and make _TypeParameters public, I don't see any reason why we shouldn't. When we do make this public, we'll need to make sure we update DevTools to handle this since the object inspector probably has explicit support for the private type.

@rmacnak-google
Copy link
Contributor

pkg:vm_service acts as if it were public :(

https://dart-review.googlesource.com/c/sdk/+/316862

@bkonyi
Copy link
Contributor

bkonyi commented Jul 28, 2023

pkg:vm_service acts as if it were public :(

https://dart-review.googlesource.com/c/sdk/+/316862

That's unfortunate... :( Thanks for the quick fix!

copybara-service bot pushed a commit that referenced this issue Aug 1, 2023
…ters` and service.md claiming the existence of kind `TypeParameters`.

Fix the service type `TypeParameters` to recognize it is a heap object.

Exhaustively test that the service client libraries can handle inflating all types produced by the VM. Compare vm/cc/PrintJSON, which exhaustively tests the VM can generate any type.

TEST=ci
Bug: #52893
Change-Id: Id1f080656ef6e999e69f2ebb5b9961fa3b461e4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316862
Reviewed-by: Ben Konyi <[email protected]>
Commit-Queue: Ryan Macnak <[email protected]>
@derekxu16
Copy link
Member

I just published package:vm_service 11.9.0, which includes @rmacnak-google's fixes.

https://pub.dev/packages/vm_service/versions/11.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. pkg-vm-service
Projects
None yet
Development

No branches or pull requests

6 participants