Skip to content
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

listviews_test.dart is failing with vm_service 9.4.0 #1741

Closed
elliette opened this issue Sep 7, 2022 · 4 comments
Closed

listviews_test.dart is failing with vm_service 9.4.0 #1741

elliette opened this issue Sep 7, 2022 · 4 comments
Assignees

Comments

@elliette
Copy link
Contributor

elliette commented Sep 7, 2022

Before vm_service was at 9.3.0, and the test was passing. Upgraded to 9.4.0:
> vm_service 9.4.0 (was 9.3.0)

Running the test now fails:

dart test test/listviews_test.dart --no-retry --chain-stack-traces
Building package executable... (5.6s)
Built test:test.
00:15 +0 -1: _flutter.listViews [E]
  Expected: {
              'views': [
                {
                  'id': '1',
                  'isolate': {
                    'type': '@Isolate',
                    'id': '1',
                    'number': '1',
                    'name': 'main()',
                    'isSystemIsolate': false,
                    'isolateGroupId': ''
                  }
                }
              ]
            }
    Actual: {
              'views': [
                {
                  'id': '1',
                  'isolate': {
                    'type': '@Isolate',
                    'id': '1',
                    'number': '1',
                    'name': 'main()',
                    'isSystemIsolate': false,
                    'isolateGroupId': null
                  }
                }
              ]
            }
     Which: at location ['views'][0]['isolate']['isolateGroupId'] is <null> instead of ''

  package:test_api               expect
  test/listviews_test.dart 38:5  main.<fn>
@elliette elliette self-assigned this Sep 7, 2022
@elliette
Copy link
Contributor Author

elliette commented Sep 7, 2022

Looks like this might be related to https://dart-review.googlesource.com/c/sdk/+/257265?

Adding @liamappelbe @bkonyi for context. This is the test that is failing: https://github.com/dart-lang/webdev/blob/master/dwds/test/listviews_test.dart

Thanks!

@annagrin
Copy link
Contributor

annagrin commented Sep 7, 2022

I wonder if changing final StreamController<Map<String, Object>> _requestController; in dwds_vm_client

final requestController = StreamController<Map<String, Object>>();

and

final requestController = StreamController<Map<String, Object>>();

to StreamController<Map<String, Object?>> _requestController; would help

I believe this would also allow us to remove extra map creation on every VM service request here, which can be saving time:

requestController.sink.add(Map<String, Object>.from(jsonDecode(request)));

@annagrin
Copy link
Contributor

annagrin commented Sep 7, 2022

Ignore my previous comment, the change suggested did not help.

Found the reason for the test failure - we set the isolateGroupId to null in dwds but IsolateRef._fromJson converts it to an empty string during parsing:

 IsolateRef._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
    id = json['id'] ?? '';
    number = json['number'] ?? '';
    name = json['name'] ?? '';
    isSystemIsolate = json['isSystemIsolate'] ?? false;
    isolateGroupId = json['isolateGroupId'] ?? ''; // This line

@bkonyi Is this intentional? This causes the isolate we return in getVm to be different from the isolate returned by the listViews service extension. If this is intentional behavior of the vm, then we can make it consistent in dwds by setting the isolateGroupId to an empty string on isolate ref creation:

isSystemIsolate: isolate.isSystemIsolate,

and/or

final isolate = Isolate(

@liamappelbe
Copy link

Yeah, I have a CL to change the codegen for toJson and _fromJson to be consistent: https://dart-review.googlesource.com/c/sdk/+/258100

copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Sep 8, 2022
Bug: dart-lang/webdev#1741
Change-Id: I86df5591c3b302e88f76a2f7031215df18bb1431
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258100
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
@bkonyi bkonyi closed this as completed Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants